首页 > webdriver调用Remote启动Firefox后写入地址无反应。

webdriver调用Remote启动Firefox后写入地址无反应。

webdriver调用remote启动firefox后,浏览器写入地址没有反应

from time import sleep
from selenium.webdriver import Remote

driver = Remote(command_executor='http://127.0.0.1:4444/wd/hub',desired_capabilities={'browserName':'firefox'})

driver.get("http://www.zgckxt.com")
sleep(3)

driver.quit()

从网上找了找,基本都是java的写法,原理都差不多,对比着改了改,还是不行。webdriver.Firefox()这样启动后写入地址是正常的,没有任何问题。利用Remote驱动后不明白为什么写入不了,启动Firefox后页面就不再继续了


错误提示是:

Message: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/ge... The latest version can be downloaded from https://github.com/mozilla/ge...

所以按照提示里下载geckodriver后,解压放在火狐安装文件下C:Program Files (x86)Mozilla Firefox,并在环境变量Path里加上该路径,不再提示这个错误

当前selenium2.53,firefox47.1,selenium server3.0.0b2.直接webdriver.Firefox()是可以的,用remote方式启动就需要给firefox加上这个驱动

【热门文章】
【热门文章】