2016-07-06 41 views
1

更新到Firefox 47(這裏說明:https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver)安裝木偶後我的代碼拋出了以下錯誤:硒與提線木偶在Windows上: 「權限被拒絕」

from selenium import webdriver 
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities 
from selenium.webdriver.common.keys import Keys 

#firefox requires a new webdriver code-named marionette 
#Selenium must be told to use said driver (not necessary in the future) 
caps= DesiredCapabilities.FIREFOX 
caps["marionette"]=True 
#STABLE RELESE NOT SUPPORTED USE DEV EDITION 
caps['binary']="C:\Program Files (x86)\Firefox Developer Edition\" 
driver=webdriver.Firefox(capabilities=caps) 

拋出:

Traceback (most recent call last): 
driver=webdriver.Firefox(capabilities=caps) 
response = self.execute(Command.NEW_SESSION, capabilities) 
self.error_handler.check_response(response) 
raise exception_class(message, screen, stacktrace) 
selenium.common.exceptions.WebDriverException: Message: permission 
denied 

我已將Marionette添加到我的PATH,更名爲電線,並嘗試將硒直接指向.exe文件,但無效

回答

1

由於Firefox 47不兼容,您只需將Firefox降級到版本45即可。

您可以參考此鏈接。 Selenium 2.53 not working on Firefox 47

你可以在上面的鏈接中找到解決問題的方法。

我希望它能幫助你。

+0

UPDATE 來自:HTTP://stackoverflow.com/questions/37693106/selenium-2-53-not-working-on-firefox-47硒的webdriver 2.53.1已經發布了6月30日2016年上FirefoxDriver是使用Firefox 47.0.1作爲瀏覽器再次工作。 – pmaurais

+0

我實際上有問題,因爲我沒有在這行上使用雙反斜槓'caps ['binary'] =「C:\ Program Files(x86)\ Firefox Developer Edition \」'但是不管你的回答是否讓我升級硒並修復問題 – pmaurais

+1

我試圖運行你的程序,發現這個錯誤,但認爲這是寫錯問題的細節。 – dazzieta