Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you connect remotely using Python + Webdriver

I am trying to figure out how to connect to my remote webdriver instance.

This is the code I am currently using:

from selenium.remote.webdriver import WebDriver

driver = WebDriver("http://172.16.205.129:4444", "firefox", "ANY")
driver.get('http://google.com')
driver.quit()

I find that I can't connect and will get a connection refused, or if i play around with the code, occasionally a time out.

Any help is appreciated.

like image 878
Anthony Long Avatar asked May 17 '10 15:05

Anthony Long


1 Answers

You need to ensure selenium server hub and node are set up before the test. Please refer to this.

Example on hub run

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

Example on node to connect to hub ,run

java -jar selenium-server-standalone-2.5.0.jar -role webdriver -hub
   http://localhost:4444/grid/register -port 5555

You can have as many nodes as you want.

like image 180
JohnFairul Avatar answered Oct 11 '22 17:10

JohnFairul