Reputation: 187
I don't have multiple machines at my job. I have one window and one mac for script execution. I was wondering if i can use selenium grid for script execution on single machine.I never used selenium grid. Any article, links or suggestion is highly appreciated.
Upvotes: 4
Views: 6302
Reputation: 366
Yes, you can start a selenium gird with multiple node on single machine, but RAM should be at least 8GB because it will running test suites with more than 4 browser instance it need more RAM if not browser gets closed. http://selenium-release.storage.googleapis.com/index.html Download standalone jar.
java -jar selenium-server-standalone-2.45.0.jar -role hub
It will start hub .
To start nodes open different cmd and type following command to start 'n' number nodes. The command is below:
java -jar lib/selenium-server-standalone-2.43.1.jar -role node -hub http://localhost:4444/grid/register -port 5555
java -jar lib/selenium-server-standalone-2.43.1.jar -role node -hub http://localhost:4444/grid/register -port 6666
java -jar lib/selenium-server-standalone-2.43.1.jar -role node -hub http://localhost:4444/grid/register -port 7777
If you want to run same test case in different browser download the browser drivers here
Run the following command to start different browsers: For example:
java -jar selenium-server-standalone-2.45.0.jar -role webdriver -hub http://localhost:4444/grid/register -Dwebdriver.chrome.driver=C:\Users\xyz\Desktop\chromedriver.exe
java -jar selenium-server-standalone-2.45.0.jar -role webdriver -hub http://localhost:4444/grid/register -port 6666 -Dwebdriver.chrome.driver=C:\Users\xyz\Desktop\chromedriver.exe.
This will start chrome browser and node.
Upvotes: 9
Reputation: 1609
You can but not sure why would you. If you want to execute in a single machine you can just go ahead and create multiple instances of the web driver for different browsers and achieve that. IMHO the whole purpose of grid is to distribute the load across nodes with different browsers,OS etc ..
But to answer your question yes you can. You can run the hub and node in the same machine and test it out if that's what you want to do.
Upvotes: 0
Reputation: 1016
You can also run a grid locally using Docker. Selenium provide images for a hub, Chrome and Firefox on Ubuntu.
Upvotes: 0
Reputation: 20456
Yes you can use set up Selenium Grid on a single machine. You can download the jar file from this download link
After download, start the hub with the following command:
java -jar selenium-server-standalone-2.46.0.jar -role hub
Then register nodes to it with the following command:
java -jar selenium-server-standalone-2.46.0.jar -role node -hub http://localhost:4444/grid/register
Refer the following link for more information, the example there is for the single machine scenario with Ruby but it is similar in java.
http://elementalselenium.com/tips/52-grid
Upvotes: 4