ropensci / RSelenium

An R client for Selenium Remote WebDriver

Home Page:https://docs.ropensci.org/RSelenium

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

remDr$open does not open a browser window nor does it give an error

Rez99 opened this issue · comments

Operating System

OS Name Microsoft Windows 11 Home

Selenium Server version (selenium-server-standalone-3.0.1.jar etc.)

java -jar selenium-server-4.8.3.jar standalone

Browser version (firefox 50.1.0, chrome 54.0.2840.100 (64-bit) etc.)

Chrome 111.0.5563.147

Other driver version (chromedriver 2.27, geckodriver v0.11.1, iedriver x64_3.0.0, PhantomJS 2.1.1 etc.)

Chromedriver 111.0.5563.64

Expected behaviour

I expect remDr$open() to open a browser window or show an error

Actual behaviour

I get this output:
[1] "Connecting to remote server"
$id
[1] NA

Steps to reproduce the behaviour

remDr <- remoteDriver(
remoteServerAddr = "localhost",
port =4444L,
browserName = "chrome"
)

remDr$open()

  • I have confirmed selenium is running by inspecting http://localhost:4444/ui
  • If I change the port then remDr$open does show an error (so I don't think this is the problem)

Can you try installing the latest version of wdman from github? like so:

# install.packages("remotes")
remotes::install_github("ropensci/wdman")

that should fix the issue.

Can you try installing the latest version of wdman from github? like so:

# install.packages("remotes")
remotes::install_github("ropensci/wdman")

that should fix the issue.

I got the same issue, but I did not install the wdman package in the RStudio.

wdman is a dependency of RSelenium; which had some issues with the latest versions of one of the browser drivers. There is a fix on GitHub, which has not yet been published to CRAN, as we haven't done extensive testing.
For that reason, you should try to install the latest version of wdman yourself, which (in theory) should fix the issue.
You can do this by running the above-mentioned code.

Please report again if this does not fix your issue.

I have tried the above mentioned steps (using the development version of wdman) , and it still fails like this:

library(RSelenium)

remDr <- remoteDriver(

  • remoteServerAddr = "localhost",
  • port =4444L,
  • browserName = "chrome"
  • )

remDr$open()
[1] "Connecting to remote server"
$id
[1] NA

I run the selenium jar like this: java -jar selenium-server-4.8.3.jar standalone.
Am I doing something wrong ?

same here with newer selenium docker - the old selenium/standalone-firefox-debug:2.53.1 works but the latest selenium/standalone-firefox:4.9.0-20230421 just hangs on the open() command - updated from cran to latest github version with no change.

got it working with selenium/standalone-firefox:4.3.0-20220726

I am not so sure the problem is caused by a wrong version of wdman. It works fine with the docker images up to selenium 4.8.3. Indeed, it doesn't work anymore with selenium 4.9.0. The changelog says that support for the Json Wire protocol has been removed from selenium grid. Could it be the cause of the problem ?

The last version I was able to use outside of the docker images is the 3.141.59 release when a standalone jar was still released. Afterwards, I was never able to use the newer version. I do not know if this is caused by the the selenium server or by the RSelenium package or by the was I run the selenium webdriver. I always have the problem explained in this bug (no browser opened).

commented

I can confirm that this issue does not happen on Windows 10. I have a machine that runs Windows 10 and the selenium/standalone-firefox:latest works fine on that machine, but on the Windows 11 and Mac OS machines the $open command produces nothing and no error message.

I was able to get it to work with selenium 4.8.3 as fvalenduc suggests on Windows 11. Using Docker.

This issue is certainly not specific to Windows, I also see this problem on Linux. Can you explain how you managed to use selenium 4.8.3 in Windows without docker ?

commented

This issue is certainly not specific to Windows, I also see this problem on Linux. Can you explain how you managed to use selenium 4.8.3 in Windows without docker ?

I have clarified my comment. I am using Docker.

remDr$open() was hanging for me and eventually completing with NA:

library(RSelenium)
remDr <- RSelenium::remoteDriver(remoteServerAddr = "localhost",
                                 port = 4445L,
                                 browserName = "chrome")
remDr$open()
[1] "Connecting to remote server"
# minutes pass but nothing happens
# then eventually, if you wait long enough
$id
[1] NA

I got it working by using an older version of the selenium/chrome image: selenium/standalone-chrome:4.2.2.

Example:

docker run -d -p 4445:4444 -v /dev/shm:/dev/shm --platform linux/amd64 selenium/standalone-chrome:4.2.2

The idea comes from here.

Of course this works with old version of selenium. But we are then stuck forever with old version of chrome or firefox contained in these docker images. The main problem is that RSelenium doesn't work with versions of selenium newer than 4.8.3. The changelog for selenium 4.9.0 says that support for the Json Wire protocol has been removed from selenium grid. This is probably the real cause of the problem and there doesn't seem be enthusiasm to adapt RSelenium to this change.

I'll note that I didn't experience this issue on an old machine running Windows 10, if it's helpful for solving the problem.

But color me enthusiastic. I would really like to see this fixed!