I try to run Grid2, but I don't understant basic thing.
I have the Hub, and I run on the hub machine the next command:
java -jar selenium-server-standalone-2.14.0.jar -role hub
I have a node, and I run on it the next command:
java -jar selenium-server-standalone-2.14.0.jar -role node -hub http://localhost:4444/grid/register
Now, I want to run a test in Java that would execute only on the node (and not on the hub). But the code of the test is on the Hub machine. How can I make it happen?
If you're running the hub and node on the same machine then yes, when you run your tests they will start on the node where your hub is located. In order to get around this you're going to need at least 2 machines, 1 to run your hub and 1 to run your node.
Start your hub on machine A then have your node register to the hub, when you start your tests on the hub machine it will automatically select an available node and run the tests.
It doesn't matter where your code lies. Your code communicates with the hub and tells it which node to execute the case on based on the desiredcapabilities object.
In your case as well, the case is running on the node only. Hub just does the task of distributing it to appropriate node. Its just that the node is on the same machine as the hub, so you do not see a difference.
Related
I have my hub running on my Windows 10 machine, which is also the VirtualBox host. I am running an OS X High Sierra VirtualBox as the node.
When I try to register the node with this command:
java -Dwebdriver.firefox.driver=/Users/jlott/Desktop/geckodriver -jar /etc/selenium-server-standalone-3.12.0.jar -role node -hub http://10.195.0.159:4444/grid/register
I get the following error:
node error
Thank you in advance for any help.
While working with Selenium Client 3.x, GeckoDriver 0.20.1 and Firefox Quantum v60.0.2 to start the Selenium Grid Node you need to use the following commans:
java -Dwebdriver.gecko.driver=<absolute_path>/geckodriver -jar /etc/selenium-server-standalone-3.12.0.jar -role node -hub http://10.195.0.159:4444/grid/register
Ok, I figured out what was preventing the connection. I needed to add a firewall exception for the tcp port I am using in the Windows Firewall settings. Once I added this, the node connected successfully.
I run this command on a virtual machine to register a node with my Selenium Grid hub:
java -Dwebdriver.ie.driver=C:\IEDriverServer.exe -Dwebdriver.chrome.driver=C:\chromedriver.exe -Dwebdriver.gecko.driver=C:\geckodriver0-15-0.exe -jar selenium-server-standalone-3.3.0.jar -role node -port 5555 -hub http://10.201.1.201:4444/grid/register -browser "browserName=internet explorer, version=10, platform=WINDOWS, maxInstances=5" -browser "browserName=chrome,maxInstances=5,platform=WINDOWS" -browser "browserName=firefox,maxInstances=5,platform=WINDOWS"
As a result, the node seems to connect correctly, but every minute or so I see
"Registering the node to the hub: [hub ip]
The node is registered to the hub and ready to use."
This doesn't seem to cause any errors with my tests, but I'm curious why it is repeatedly trying to register. I believe this started when I upgraded Selenium Server Standalone to 3.3.
I'm also noting that from my hub, I see that it keeps "marking the node as down because it can't be reached for 2 tries". Then it immediately registers that node again, and then it's down again, repeated forever.
There is a bug that should be fixed in version 3.3.1. It seemed to produce the same problem you're seeing. If it still doesn't work I'd recommend commenting on the github issues.
I am trying to install Selenium Grid - hub in one machine(windows 10) and node(windows 8.1 physical device) in different machine. I am able to successfully register the hub, but stuck in node registering. I used java -jar C:\selenium-server-standalone-3.0.0.jar -role node -hub http://192.168.56.1:4444/grid/register -port 5555. Getting error: couldnt register the node: the hub is down or not responding. I tried webdriver instead of node, still no luck. Any help will be much appreciated. Thanks
I'm using Selenium grid to run multiple instances of my test in parallel. I want to test if I can run a lot of browsers at the same time. My problem is that I can't have more that 5 five browsers at the same time, and I don't know why.
Here are the commands I'm using to start the hub and the node:
java -jar %seleniumPath% -port 4444 -role hub -nodeTimeout 1000
java -jar %seleniumPath% -role node -hub http://localhost:4444/grid/register -browser browserName=firefox,maxInstances=1,maxSession=1 -port 5555
NOTE: The two commands are working but what I don't understand are the maxInstances and the maxSession arguments. I set them to 1 but I can still run more than one browser and if I set them to 10 or more only 5 browsers will run at the same time.
What should I do to have more than 5 browsers running at the same time?
Generally, according to Selenium Grid2 official documentation, -maxSession is the maximum number of browsers that can run in parallel on the node while -maxInstances sets how many instances of a particular browser can run simultaneously.
Don't forget to restart the local java process responsible for node session on each remote machine to apply these settings.
My problem is how to get an isolated video streams from SeleniumServer browser instances. Let me explain.
I have Selenium Server hub running at Ubuntu Server machine and the Selenium Server node running at the same server so I use the 'headless' Selenium mode using xvfb. I run the nodes like this: DISPLAY=:99 java -jar selenium-server-standalone.jar -role node -hub http://localhost:4444/grid/register
Then I wanna get video streams of the tests running there so I installed the x11server connected to the xvfb virtual display and after that I can to connect those remote server using VNC and I see my tests processing. The trouble is that all browser instances inside the node rendered at the same virtual display (#99) and when I need running several tests at the same time, I see many browser instances overlaying one by one. But I wanna record the error tests video streams so I can't do this. So I need to have probability to connect to every browser virtual display apart.
I think I can solve this problem by tuning the xvfb server somehow to force it to create isolated virtual display or screen (xvfb has multiscreen support, hasn't it?) for every client (browser instance in my case). But I have tried to do this and I have not get a result. Also I can use another virtual display (not xvfb) if it's necessary to solve this.
Please, help me to get isolated video streams from every browser instance :) Thanks a lot and sorry about my English.
With the selenium hub, you can add the browsers in separately in their own Xvfb sessions
java -jar selenium-server-standalone-2.33.0.jar -role hub&
then connect each browser separately in its own Xvfb session, DISPLAY and port
export DISPLAY=:11
Xvfb :11 -screen 0 1024x768x16 &
java -jar selenium-server-standalone-2.33.0.jar \
-role node \
-port 4441
-hub http://localhost:4444/grid/register \
-browser "browserName=firefox,version=19,maxInstances=5"&
For this kind of use, you could typically use the xvfb-run command (which can select automatically a display, but it can be configured)
Then you can create a firefox start script that would do xvfb-run firefox that you could use as the selenium firefox start command (specified as a FirefoxBinary)