selenium grid: can't connect to hub and node - selenium-grid

I encounter some problems to set up a selenium grid. Yet I tried to refer to the instructions of several tutorials.
I placed the selenium server in a particular folder. I open 2 terminals from this folder.
In one I enter the following command
java -jar selenium-server-4.1.1.jar -role hub
I get the following answer:
In the second one:
java -jar selenium-server-4.1.jar -role node -hub http://localhost:4444
I get the following answer:
my configuration:
Lenovo terra
Linux Ubuntu 20.04
usual chrome browser
selenium server 4.1.1
I saw the same thing on several tutorials. What am I missing?

I finally solve the problem, the correct command is:
java -jar selenium-server-<your version>.jar standalone

Related

Unable to connect Selenium 3.12.0 Grid Node to the Grid Hub

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.

Node is not accessible from hub in selenium grid

I just started the hub on my local machine using the following command.
java -jar selenium-server-standalone-3.12.0.jar -role hub
it started successfully, then I have tried to connect a node to another machine using the following command.
java -Dwebdriver.chrome.driver=d:\sel\new\chromedriver.exe -jar selenium-server-standalone-3.12.0.jar -role node -port 5566 -hub http://"HUbip":4444/grid/register
it has shown me The node is registered to the hub and ready to use in the console.
but when I opened Http://"HUbip":4444/grid/console it has shown the IP and 5 chrome browser, 5 Firefox, 1 internet explorer logos. But at the top of that, the text has shown like "DefaultRemoteProxy unknown version, Failed to connect to Ip of the node".
so when I have tried to run the test I am getting an error like "Could not start a new session. Possible causes are the invalid address of the remote server or browser start-up failure.
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z'".
I have already switched off both machine's firewall. and tried to telnet from the node to hub, it was a success.
I am unable to rectify the issue. someone, please suggest a solution.
Add in Selenium Grid Extras which can help you with the management of Selenium Grid like :
Restart the node/hub
Clear session
Recommends the defaults for the ports
You'll need to run the setup on the hub and node:
java -jar SeleniumGridExtras-*.*.*-SNAPSHOT-jar-with-dependencies.jar
Note: You're not using the standard port for the node 5555.

Selenium Grid Support - launch multiple browser windows from same machine

We know that Selenium Grid is supporting parallel testing from different machines.
My Objective is to launch multiple browser windows from same machine and launch tests from same machine parallel. Is it possible with Selenium grid? Could you guide me here, please?
Regards,
-kranti
Yes, you can do it and you can even specify how many windows you want to run at once on given computer. All is done through -browser parameter:
java -jar selenium-server-standalone-2.42.0.jar -role node -browser browserName=firefox,maxInstances=3 -hub http://localhost:4444/grid/register
The above parameter allows the node to run up to 3 instances of firefox browser at once.
Later on, the computer will open 3 different instances of Firefox and run the tests. It worked well in my setup.

How to run selenium server sessions on different xvfb screens?

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)

Running Selenium IDE tests via Selenium Grid

I should start off by saying that I am regretfully and painfully a noob. But I'm trying to change that!! I do not know any programming languages, but have managed to "make things happen" by doing enough research to get whatever job I've ever needed done done.
Anyway, I have been creating Selenium tests using the Selenium IDE and I am having a bit of trouble getting these test to run via Selenium Grid.
I have been exporting the tests as JUnit 4 (Webdriver) files. I am running the grid on a Ubuntu headless server, and my remote controls on one Windows 7 machine running IE9 and Firefox, and a Windows Vista machine running IE8 and Chrome.
My goal is to take the tests that I've exported from Selenium IDE as JUnit 4 (Webdriver) files and run them from the grid in parallel on my two Windows machines. I have edited my hosts files on my Windows machines to recognize the Ubuntu server by the name of "seleniumgrid". For example:
On the Ubuntu server terminal 1:
ant launch-hub
Win7 terminal1:
ant -Dport=5555 -Denvironment="IE9 on Windows" -Dhost=Win7 -DhubURL=http://seleniumgrid:4444 launch-remote-control
Win7 terminal2:
ant -Dport=5555 -Denvironment="Firefox on Windows" -Dhost=Win7 -DhubURL=http://seleniumgrid:4444 launch-remote-control
Vista termina1:
ant -Dport=5555 -Denvironment="IE8 on Windows" -Dhost=WinVista -DhubURL=http://seleniumgrid:4444 launch-remote-control
Vista terminal2:
ant -Dport=5555 -Denvironment="Chrome on Windows" -Dhost=WinVista -DhubURL=http://seleniumgrid:4444 launch-remote-control
Now, from here, I'm trying to launch the JUnit4 (webdriver) file that I have exported from Selenium IDE to run this configuration. The name of the file is titled : Registration.java.
What do I have to do now to run the Registration.jar file? I can't seem to find any documentation that answers this question, which leads me to believe that I have a fundamental misunderstanding of how this all works...
Pardon if this question has been answered before. I have poor terminology when it comes to this stuff.
HUGE thanks for taking the time to read this, and even more for an answer if there is one.
-brandon
There is no need to launch hub and nodes via ant. You can run them from cmd:
java -jar selenium-server-standalone-2.21.0.jar -role hub -- will run hub
java -jar selenium-server-standalone-2.21.0.jar -role node -hub http://seleniumgrid:4444/grid/register -- will run node
Default port for node is 5555, so for the second terminal you should specify port that differs from default one, e.g. 5556:
java -jar selenium-server-standalone-2.21.0.jar -role node -port 5556 -hub http://seleniumgrid:4444/grid/register
Also you should specify browser parameters for each node, e.g.:
-browser browserName=firefox,maxInstances=5,platform=WINDOWS
In your JUnit tests you should use RemoteWebDriver with DesiredCapabilities:
DesiredCapabilities capability = DesiredCapabilities.firefox();
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
For parallel execution you should edit your tests additionally (sorry, don't work with jUnit, so can't help here much except of link that you can find below.)
Include JUnit class files, your class files, including your JUnit test classes, libraries your class files depend on in your classpath on Linux machine:
export CLASSPATH=$JUNIT_HOME/junit.jar:/myproject/classes:/myproject/lib/something.jar
Invoke the Junit command on Linux machine:
java org.junit.runner.JUnitCore [test class name]
Or you can use ant instead.
I will recommend to start with hub on Linux and one node with one browser on Windows without any parallelization, so you will be sure that this part works correctly. As a next step run tests for two nodes sequentially and then try to run them in parallel.
For complete tutorials read these materials: How do I run JUnit using Ant, Activating Junit tests from Command Line, Grid2 tutorial, Parallel JUnit 4 and Selenium (three parts)