Selenium – How to launch multiple browsers with selenium grid

seleniumselenium-gridwebdriver

I'm writing test cases in WebDriver,JUnit,Java , Now I'm trying to implement Grid. (Launching the browser in parallel with same test case)

I've started the hub with this

java -jar selenium-server-standalone-2.18.0.jar -role hub

started node with this

java -jar selenium-server-standalone-2.18.0.jar -role node -hub http://localhost:4444/grid/register

It by default have some firefox, ie, chrome instances

Now I've started my test case
while running the test case I'm able to see in which instance it is running. (That instance is somewhat dim comparative to other instances.)

Now I've started my test case 5 times simultaneously (It is taking different instance of browsers), when I tried to start one more time In localhost:4444/grid/console it is showing

1 requests waiting for a slot to be free.
{platform=ANY, browserName=firefox, version=}

but, How can I launch 5 browsers in parallel with single click (Running the test case only once )?

Do I need to pass any parameter to node while starting to start test cases in parallel? or Do I need to specify anything in my test case?

Looking forward for your help.

Best Answer

To launch 5 browsers in parallel with 1 click (Running test case only once)..For this you need to invoke 5 browsers parallely in your code (inside that single test case).

Hub (Server) will just re-direct the requests to nodes registered with it. It's the testcase responsibility to invoke 5 browsers parallely and send those 5 requests at a time to HUB.

Incase if you want any node to handle more than default(5) sessions at a time. Please use following command

java -jar selenium-server-standalone-2.18.0.jar -role node -hub http://localhost:4444/grid/register -maxSession 10
Related Topic