When using only Selenium server it was possible to run the tests in the single browser window with the setting
-java -jar selenium-server-standalone-2.2.0.jar -singleWindow
When switched to grid 2, -singleWindow parameter is not working anymore.
Help is really appreciated.
Made it happen by running the following line:
java -jar selenium-server-standalone-2.2.0.jar -role webdriver -singleWindow -hub http://192.168.1.149:4444/grid/register -port 5557
Seems like the order of the parameters is important.
Related
I'm using nightwatch to run tests in parallel. I would like to be able to run multiple tests at a time in different selenium processes. How can I accomplish that?
What I did is create a selenium hub:
java -jar /opt/selenium-server-standalone-2.53.0.jar -Dwebdriver.chrome.driver=/usr/bin/chromedriver -Dwebdriver.chrome.bin=/usr/bin/google-chrome -log /home/jenkins-user/log/selenium.log -role hub &
And when each test runs, I create a node:
java -jar /opt/selenium-server-standalone-2.53.0.jar -Dwebdriver.chrome.driver=/usr/bin/chromedriver -Dwebdriver.chrome.bin=/usr/bin/google-chrome -log /home/jenkins-user/log/selenium.log -role node -browser browserName=chrome -hub http://localhost:4444/grid/register &
Unfortunately, this prevents me from running nightwatch tests in parallel.
What am I doing wrong?
Why do you want to start multiple selenium processes? You should not do that.
Check my answer for similar question: Running multiple nightwatch instances
This problem is making me crazy. I'll try to explain it.
I have a Selenium grid environment with two machines (HUB & NODE). I use .bat files to start the hub and the nodes, something like the code below:
HUB:
Here I start the hub:
start java -jar C:\workspace\selenium-server-standalone-2.45.0.jar -role hub -port 4444
Here I start a .bat on the node machine that will start the node.
psexec.exe \\XXX.XXX.XX.XXX -s -e -u USER -p PASSWORD -i 2 C:\Selenium\StartNode.bat
NODE:
To register the node:
java -jar C:\selenium\selenium-server-standalone-2.45.0.jar -role node -hub http://XXX.XXX.XX.XXX:4444/grid/register
I have this from the beginning (more or less 6 moths) and was fine and simple, but now I see very weird (for me) things but only in Internet Explorer. Basically, the node starts, IE opens to correct page but nothing happens. I just have "object not found errors..." Firefox and Chrome are just fine.
But, if I start the node directly on it (NODE machine, so not from HUB via psexec), it works fine for IE as well?
Do you guys have any logical explanation? I really have no idea.
I suppose you need to provide IEDriver exe when starting the node like below.
java -jar selenium-server-standalone-2.45.0.jar -role webdriver -hub http://192.168.1.100:4444/grid/register -browser browserName="internet explorer",version=10.0,platform=WINDOWS -Dwebdriver.internetexplorer.driver=c:\Selenium\InternetExplorerDriver.exe
Try to create node using such command:
java -Dwebdriver.ie.driver=C:\selenium\IEDriverServer.exe -jar C:\selenium\selenium-server-standalone-2.45.0.jar -role node -nodeConfig C:\selenium\nodeIE1.json
I used node instead webdriver (the last one is used for backward compatibility) and latest version of IEDriverServer
It works great for me. And you may try nssm to run your hub and node as win services instead using .bat files.
How to run Selenium Test Cases parallely without using TestNG or JUnit.
Currently i am using the command
Client(Node) command :
java -jar selenium-server-standalone-2.35.0.jar -role node -hub
Protocol://host:4444/grid/register -browser browserName=firefox,platform=WINDOWS maxInstances=3.
But its not working.
I Need to execute one/many test cases parelley(at a time 5) in Firefox
Java -jar selenium-server-standalone-2.35.0.jar -role node -hub Protocol://host:4444/grid/register -browser browserName=firefox,platform=WINDOWS maxInstances=3.
But its not working.
It won't work. By running the above command you are setting up selenium grid to run 3 instances of test IF and When it gets 3 requests. You need to write the logic to pass three instances of tests pointing to the hub in parallel for the node to work its magic.
To run tests in parallel using java, you need to create logic using multithreading. You should take care to
make your classes thread safe
Specify which tests to run
Create a report of testing so that others can know what your test is doing
Or you can use JUnit or testNG which will do most of these for you.
You could do it using Maven Surefire, which has parallel running capability. You would only want to use TestNG if you need to parameterize. Surefire creates a pretty ok test report also.
I've tried this on multiple versions of selenium 2 (from 2.24-2.28) and on two different systems. It's a very simple scenario. I want to run RC commands via Selenium Grid and I don't want to port my 1000+ test scripts to WebDriver, so hopefully that's not the only solution.
Test case:
1) START HUB:
java -jar selenium-server-standalone-2.28.0.jar -role hub
2) START NODE:
java -jar selenium-server-standalone-2.28.0.jar -role node -hub http://localhost:4444/grid/register
(I've tried every variation of this I could think of, including -role rc)
Communications seem fine between the two. The console status is up and shows the connection between the two.
3) REQUEST RC URL:
http://localhost:4444/selenium-server/driver/?cmd=getNewBrowserSession&1=*firefox&2=http://www.google.com
Output is always:
HTTP ERROR: 500
Problem accessing /selenium-server/driver/. Reason:
java.lang.NullPointerException
If I revert to non-grid mode, the request returns as expected.
Am I missing something or is RC simply not supported under Grid 2?
This seems to be fixed for *firefox as a browser in 2.30 however I still observe the same behaviour for *googlechrome
I fear this is a very trivial question. But I'm having some trouble getting selenium Grid2 to run multiple test against a single node, from my understanding this should be possible by setting maxSessions.
This is my setup:
-Hub runs completly standard
-Node runs firefox with 5instances and 5 sessions enabled.
I've created 6 dummy tests using MBUNIT and added [Paralizable] to make them run side by side.
This is what I've done to test:
1: Start 2 nodes and run all tests (they run in parallel one on each node)
2: Turn off nodeA and run all tests
In step 2 is where i get stuck, i expected the last node would run 2 tests at once since the maxSessions is set to 5 but this doesn't happen, it only runs 1.
I suspect I've used a wrong parameter when starting the hub or node somewhere but right now i can't figure it out. anybody who want to help a newbie at Grid2? :)
This is roughly my code, very basic just for playing around:
[TestFixture]
public class RemoteTest
{
[Test]
[Parallelizable]
public void StartClose()
{
DesiredCapabilities cap = DesiredCapabilities.Firefox();
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), cap);
driver.Navigate().GoToUrl("http://www.google.dk");
driver.Quit();
}
}
Commands used:
java -jar selenium-server-standalone-2.14.0.jar -role hub
java -jar selenium-server-standalone-2.14.0.jar -role node -hub http://192.168.0.26:4444/grid/register
no question is trivial :)
To start a server (use the following command)
java -jar selenium-server-standalone-2.14.0.jar -role hub
To start a Node (use the following command)
java -jar selenium-server-standalone-2.14.0.jar -role node -hub
http://localhost:4444/grid/register
Incase if u had tried to start a node with browsers as well (check the following command)
-browser browserName=firefox,version=3.6,maxInstances=5,platform=LINUX
maxInstances --> Signify the Max instances of same browser that can run on a Grid node
Selenium Grid: MaxSessions vs MaxInstances
If you specify capabilities in your test case that do not exist on your grid then there will be no match and the test will fail to run.
Please avoid running the tests from the Nodes and instead run tests from hub. I tried the same experiment where I ran the tests from the server (HUB) and I registered a node for running parallel test cases and everything worked perfect.