猿问

硒 WebDriverexception

我有一个网络驱动程序例外使用来自硒的网络驱动程序


[]# python3.4 file.py

Traceback (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 webdriver

browser = webdriver.Firefox()

...


繁花如伊
浏览 82回答 1
1回答

翻翻过去那场雪

如果您在没有显示器的系统上运行 Firefox,请确保使用无外设模式。from selenium import webdriverfrom selenium.webdriver.firefox.options import Optionsoptions = Options()options.headless = Truedriver = webdriver.Firefox(options=options)另外,请确保您有兼容版本的火狐,硒和壁虎驱动器:https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html这也应该有所帮助
随时随地看视频慕课网APP

相关分类

Python
我要回答