Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将firefox配置文件传递到远程webdriver firefox实例不工作_Python_Selenium_Grid_Selenium Webdriver - Fatal编程技术网

Python 将firefox配置文件传递到远程webdriver firefox实例不工作

Python 将firefox配置文件传递到远程webdriver firefox实例不工作,python,selenium,grid,selenium-webdriver,Python,Selenium,Grid,Selenium Webdriver,我正在尝试启动Firefox的一个远程webdriver实例,并传入一个配置文件 profile = webdriver.FirefoxProfile() profile.set_preference("browser.download.folderList","2") self.webdriver = webdriver.Remote(desired_capabilities=webdriver.DesiredCapabilities.FIREFOX,browser_profile=profi

我正在尝试启动Firefox的一个远程webdriver实例,并传入一个配置文件

profile = webdriver.FirefoxProfile()
profile.set_preference("browser.download.folderList","2")
self.webdriver = webdriver.Remote(desired_capabilities=webdriver.DesiredCapabilities.FIREFOX,browser_profile=profile)
这是行不通的。如果我将其传递到Firefox webdriver实例中,它就可以正常工作

profile = webdriver.FirefoxProfile()
profile.set_preference("browser.download.folderList","2")
self.webdriver = webdriver.Firefox(firefox_profile=profile)

有虫子吗?我使用的是Firefox9和Selenium 2.16,所以这要么是Selenium的一个bug,要么是已经修复的Firefox。问题是browser.download.folderList是一个整数,所以我将它改为int,它可以工作

我对Selenium 2.39.0的调用看起来与上面的有点不同。请注意.Remote调用的键是“browser\u profile”,而不是上面使用的“firefox\u profile”

    profile = webdriver.FirefoxProfile()
    profile.accept_untrusted_certs = True

    executor = "https://" + \
        self.env.getSeleniumHub()['ip'] + \
        ":4444/wd/hub"

    capabilities = self.env.getSeleniumCapabilities("firefox")

    self.driver = webdriver.Remote(
        browser_profile=profile,
        desired_capabilities=capabilities,
        command_executor=executor)
    self.driver.implicitly_wait(10)

所以这要么是Selenium的bug,要么是Firefox已经修复的bug。问题是browser.download.folderList是一个整数,所以我把它改为int,它就可以工作了。