简体   繁体   中英

How to build remote Webdriver for Chrome in python

I've start the hub and rc,like the below:

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

java -jar selenium-standalone-2.21.0.jar -role wd -hub http://localhost:4444/grid/register  -Dwebdriver.chrome.driver=path-to-chromedriver 

but when i use code like this:

capability =webdriver.DesiredCapabilities.CHROME
driver = webdriver.Remote("http://172.16.21.13:4444/wd/hub", capability)
driver.get("http://www.google.com")

it fails and the error is:'Error forwarding the new session cannot find : {platform=ANY, javascriptEnabled=true, browserName=chrome, version=}'

so, who can tell me how to run remote chome correctly,thanks in advance

I think this is a problem with empty version in desired capabilities. Try launching with just browserName: driver = webdriver.Remote("http://172.16.21.13:4444/wd/hub", { "browserName": "chrome"})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM