我有一个网络驱动程序例外使用来自硒的网络驱动程序[]# python3.4 file.pyTraceback (most recent call last): File "file.py", line 195, in <module> browser = webdriver.Firefox() File "/usr/lib/python3.4/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__ keep_alive=True) File "/usr/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__ self.start_session(capabilities, browser_profile) File "/usr/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/usr/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/lib/python3.4/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace)selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process我读到这个异常可能是由不同模块之间的版本问题引起的。但似乎不是这里的问题。硒版本:3.141壁虎司机版本:0.26菲福克斯版本:68.5.0esr蟒蛇: 3.4你有什么想法吗?来源:from selenium import webdriverbrowser = webdriver.Firefox()...
1 回答
翻翻过去那场雪
TA贡献2065条经验 获得超13个赞
如果您在没有显示器的系统上运行 Firefox,请确保使用无外设模式。
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)
另外,请确保您有兼容版本的火狐,硒和壁虎驱动器:https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html
这也应该有所帮助
添加回答
举报
0/150
提交
取消