所以不幸Webdriver
的是不再适用于 Firefox 47+,所以我正在考虑切换到Marionette
.
我一直按照此页面上的说明进行操作
不幸的是,下面的示例代码没有运行:
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
caps = DesiredCapabilities.FIREFOX
caps["marionette"] = True
caps["binary"] = "C:\Program Files (x86)\Firefox Developer Edition\firefox.exe"
driver = webdriver.Firefox(capabilities=caps)
我收到以下错误:-
Traceback (most recent call last):
File "D:\Programming\repos\locreqmonkey\.git\LRT_Monkey\LRT_Monkey.py", line 21, in <module>
driver = webdriver.Firefox(capabilities=caps)
File "C:\Users\rhonore\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 60, in __init__
self.service.start()
File "C:\Users\rhonore\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\service.py", line 59, in start
self.log_file = file("geckodriver.log", "w")
NameError: name 'file' is not defined
很确定这是我错过的愚蠢的东西,但我不知道它是什么。有任何想法吗?