WebDriverException: Message: invalid argument: can't kill an exited process with GeckoDriver, Selenium and Python on RaspberryPi3

后端 未结 11 707
一整个雨季
一整个雨季 2020-11-22 11:04

Server: Raspberry Pi 3
OS: Dietpi - version 159
Geckodriver version: 0.22 for arm
Firefox version: 52.9.0
Python version: 3.5
Selenium version: 3.14.1 <

相关标签:
11条回答
  • 2020-11-22 11:24

    I had the same problem, and realized that the real problem was some firefox dependencies not being installed inside the docker container I was testing in.

    Try to initiate firefox and check if it returns an error.

    0 讨论(0)
  • 2020-11-22 11:24

    I was able to fix this by running my tests with Xvfb. I was running them on a remote server.

    I was using Jenkins so I checked the box that looked like this:

    Credit to https://www.obeythetestinggoat.com/book/chapter_CI.html

    0 讨论(0)
  • 2020-11-22 11:29

    As there can be many different underlying causes for this error it is best to find the root cause setting selenium to use debug level logging. In my case, for Ruby with capybara I needed to set: Selenium::WebDriver.logger.level = :debug. And voilà, running the same spec I could see in the logs that a dependency was missing, in my case:

    libdbus-glib-1.so.2: cannot open shared object file: No such file or directory
    Couldn't load XPCOM.
    

    After installing it all worked fine.

    0 讨论(0)
  • 2020-11-22 11:32

    If you are running Firefox on a system with no display, make sure you use headless mode.

    from selenium import webdriver
    from selenium.webdriver.firefox.options import Options
    
    options = Options()
    options.headless = True
    driver = webdriver.Firefox(options=options)
    

    Also, make sure you have compatible versions of Firefox, Selenium, and Geckodriver: https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html

    0 讨论(0)
  • 2020-11-22 11:33

    This solution worked for me

    from selenium import webdriver
    from selenium.webdriver.firefox.options import Options
    
    options = Options()
    options.headless = True
    driver = webdriver.Firefox(options=options)
    
    0 讨论(0)
提交回复
热议问题