簡體   English   中英

將firefox配置文件傳遞給遠程webdriver firefox實例無法正常工作

[英]Passing a firefox profile to remote webdriver firefox instance not working

我正在嘗試啟動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)

有bug嗎? 我正在使用Firefox 9和Selenium 2.16

所以這是一個已經修復的Selenium或Firefox的錯誤。 問題是browser.download.folderList是一個整數,所以我將它改為2並且它有效

我對Selenium 2.39.0的調用與上面的內容略有不同。 注意“browser_profile”作為.Remote調用的鍵,而不是上面使用的“firefox_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)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM