Can't connect RSelenium to Selenium server: "Timeout was reached"

381 Views Asked by At

I'm totally new to Selenium and RSelenium. I installed Docker and made it run a Selenium image, but I'm stuck at connecting to it through RSelenium package.

I've tried passing many different arguments to remoteDriver(), but whenever I try to $open() the driver, I get the following error:

remDr<-remoteDriver([IP], 4444, "chrome")
remDr$open()
[1] "Connecting to remote server"
Error in checkError(res) : Undefined error in httr call. httr output: Timeout was reached: [...] Connection timed out after 10005 milliseconds

I always set browser to "chrome".

By running 'docker container ls' on the command prompt, I get that the container I'm trying to connect to has the following port parameters: 4444/tcp, 0.0.0.0:4444->4445/tcp. Hence, I've tried passing both 4444 or 4445 (with or without L) to the port parameters in the function.

I suppose that real problem is the remote server address. By running 'docker inspect CONTAINER_ID' at the command prompt, I get a messy list of characteristics and extracted from that all the possibilities of IP addresses imaginable.

Noteworthy passages from that list concerning IPs are:

"NetworkSettings"
       "Gateway": [ActualIP1],
       "GlobalIPv6Address": "",
       "GlobalIPv6PrefixLen": 0,
       "IPAddress": [ActualIP2],
       "IPPrefixLen": 16,
       "IPv6Gateway": "",
       "Networks": {
           "bridge": {
               "Gateway": **[ActualIP1]**,
               "IPAddress": **[ActualIP2]**,
               "IPPrefixLen": 16,
               "IPv6Gateway": "",
               "GlobalIPv6Address": "",
               "GlobalIPv6PrefixLen": 0,

Armed with that, I've tried to pass the following values to the remoteServerAddr parameter: "localhost", just leaving it blank (defaults to localhost), "0.0.0.0", ActualIP1 and ActualIP2.

It never works. I get a different error when using 0.0.0.0, for instance, but I've only tried that out of desperation. I expected that ActualIP2 would be the correct setting, but it isn't - or there is something else wrong and I can't imagine what it is.

Can someone help me out, please? I'm on Windows 10, using RStudio 1.3.1093. Selenium is running on a container powered by Docker Desktop 3.0.0.

0

There are 0 best solutions below