I launched a hub on the physical machine (Windows 10, RAM 16Gb, x64):
java -jar selenium-server-standalone-2.53.0.jar -role hub port 4444
Also I registered a node on the virtual machine (I use VirtualBox: Linux, Ubuntu 16.04.2; i386. Base memory: 2048 Mb):
java -jar selenium-server-standalone-2.53.0.jar -role webdriver port 9999 -hub http://172.xx.xxx.248:4444/grid/register
Node is visible from grid console, but connection is failed
Cannot run tests.
Configurations in IDE: WebDriver driver = new RemoteWebDriver(new URL("http://10.0.2.15:9999/wd/hub"), capabilities);
Error while running the tests:
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to 10.0.2.15:9999 [/10.0.2.15] failed: Connection timed out: connect
Physical machine address: 172.xx.xxx.248
Virtual machine address: 10.0.2.15
I found a solution. VM (VirtualBox in my case) should be configured the following way:
Go to Settings -> Network
1. Attached to should be 'Bridged Adapter'
2. Expand 'Advanced' -> Promiscuous mode should be 'Allow All'
You are starting your RemoteWebDriver with wrong URL, you should give it hub IP to register on, not node IP.
WebDriver driver = new RemoteWebDriver(new URL("http://172.xx.xxx.248:4444/wd/hub"), capabilities);
This should solve your issue.
Related
I have got a VPN set up like a VPN server running in Oracle Cloud - Oracle Linux 8; the client is my local VM - Manjaro Linux. The VPN connection works just fine.
My Selenium Hub is running on the same Oracle Cloud instance, Selenium Node is running on the same local Manjaro VM, so they're on the same network, as needed.
Starting Selenium Hub works, but when starting Node it says:
[SelfRegisteringRemote$1.run] - Couldn't register this node: Error sending the registration request: No route to host (Host unreachable)
I started Host like:
java -Djava.net.preferIPv6Stack=false -jar selenium-server-standalone-3.141.59.jar -role hub
It says:
>13:40:52.933 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
>13:40:53.079 INFO [GridLauncherV3.lambda$buildLaunchers$5] - Launching Selenium Grid hub on port 4444
>13:40:53.566:INFO::main: Logging initialized #949ms to org.seleniumhq.jetty9.util.log.StdErrLog
>13:40:53.763 INFO [Hub.start] - Selenium Grid hub is up and running
>13:40:53.766 INFO [Hub.start] - Nodes should register to http://10.9.0.1:4444/grid/register/
>13:40:53.767 INFO [Hub.start] - Clients should connect to http://10.9.0.1:4444/wd/hub
I started Node like:
java -Djava.net.preferIPv6Stack=false -jar selenium-server-standalone-3.141.59.jar -role node -hub http://10.9.0.1:4444
(10.9.0.1 is the VPN given IP of Selenium Host)
and it says:
>16:16:25.675 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
>16:16:25.950 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Launching a Selenium Grid node on port 31862
>2021-07-15 16:16:26.077:INFO::main: Logging initialized #754ms to org.seleniumhq.jetty9.util.log.StdErrLog
>16:16:26.368 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
>16:16:26.520 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 31862
>16:16:26.521 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Selenium Grid node is up and ready to register to the hub
>16:16:26.629 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms.
>16:16:27.092 WARN [SelfRegisteringRemote.registerToHub] - Error getting the parameters from the hub. The node may end up with wrong timeouts.No route to host (Host unreachable)
>16:16:27.102 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://10.9.0.1:4444/grid/register
>16:16:27.266 INFO [SelfRegisteringRemote$1.run] - Couldn't register this node: Error sending the registration request: No route to host (Host unreachable)
Since VPN works fine, so the 2 machines are on the same network, as needed for Selenium Grid, I have no clue what can be wrong, especially after so many hours of Googling, even here on Stack Overflow.
Any suggestions?
If I understand it correctly, we can have a server machine running Selenium+Chrome+Chrome driver,
and a client machine that uses the RemoteWebDriver:
On the server we execute this:
$ java -jar selenium-server-standalone-{VERSION}.jar
On the client, we have a Java program with something like:
WebDriver driver = RemoteWebDriver.builder()
.addAlternative(new ChromeOptions())
.setCapabilitiy("proxy", new Proxy())
.build();
driver.get("http://example.com/");
However, how does the client know the ip and port of the server?
Ref:
https://seleniumhq.github.io/docs/remote.html
https://github.com/SeleniumHQ/selenium/wiki/RemoteWebDriver
Set the URL on the RemoteWebDriver to your server.
WebDriver driver = RemoteWebDriver.builder().url(new URL("https://here.com:1234")).build()
I am trying to launch my serenity-Cucumber tests on a Jenkins server. Actually I'm stuck with a simple error when it launch ChromeDriver :
"IPv4 port not available. Exiting..."
My failed tests are simple : goes to a special url and verify if the url is the one expected
I'm running on maven 1.9.9 - cucumber 1.9.5 - serenity 1.9.9 - chromedriver 2.40 - jenkins 2.19.1
I run my project with command "clean verify"
I tried to set a proxy but it didn t change anything - and I tried to change chromeDriver's port without results
Is there someone who has already face this problem ?
Starting ChromeDriver 2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7) on port 4013
Only local connections are allowed.
Starting ChromeDriver 2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7) on port 9015
Only local connections are allowed.
IPv4 port not available. Exiting...
While running my simple selenium automation script on chrome broswer, i am getting below mentioned error. The script runs fine on firefox browser. Mine is HTTPS website.
No connection could be made because the target machine actively
refused it. - connect(2) for "127.0.0.1" port 9515
(Errno::ECONNREFUSED)
IDE: Ruby Mine 7.1.4
Chrome Browser: 54.0.2840.71 m (64-bit)
Script:
require "selenium/webdriver"
driver = Selenium::WebDriver.for :chrome
driver.get('http://google.com')
I had same problem as yours after Windows Update last time.
I updated chromedriver.exe from v2.9 to v2.24 and put it on bin directory where ruby installed, then it's fixed.
I'm working on Selenium and I currently have a hub connected to two vms running linux with all the browsers.
I was able to launch browsers until suddenly it just stopped . Firefox or any of the other browsers don't launch. I get the following error.
Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms.
I am running Selenium-server-standalone 2.26 with firefox 16.0.2 .
Please help.
Try running this before you start your Selenium server:
export DISPLAY=:0