简体   繁体   中英

Passing a firefox profile to remote webdriver firefox instance not working

I'm trying to start up a remote webdriver instance of Firefox and pass in a profile.

profile = webdriver.FirefoxProfile()
profile.set_preference("browser.download.folderList","2")
self.webdriver = webdriver.Remote(desired_capabilities=webdriver.DesiredCapabilities.FIREFOX,browser_profile=profile)

this is not working. If I pass it into the Firefox webdriver instance it works fine

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

Is there a bug? I'm using Firefox 9 and Selenium 2.16

So this was either a bug with Selenium or Firefox that has been fixed. Problem is that browser.download.folderList is an integer, so I changed it 2 to int and it works

My call with Selenium 2.39.0 looks a little different than what's above. Note "browser_profile" as the key for the .Remote call, instead of "firefox_profile" used above.

    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)

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