系统相关
首页 > 系统相关> > WebDriverException:消息:无效参数:无法在RaspberryPi3上使用GeckoDriver,Selenium和Python终止已退出的进程

WebDriverException:消息:无效参数:无法在RaspberryPi3上使用GeckoDriver,Selenium和Python终止已退出的进程

作者:互联网

服务器:Raspberry Pi 3
操作系统:Dietpi – 版本159
Geckodriver版本:手臂0.22
Firefox版本:52.9.0
Python版本:3.5
Selenium版本:3.14.1

Gecko是可执行的,位于/usr/local/bin /

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.firefox.options import Options
import time



options = Options()
options.set_headless(headless=True)
driver = webdriver.Firefox(firefox_options=options)

print('Need your login credential')
username = input('What is your username?:\n')
password = input('What is your password?:\n')
...
...

输出:

root@RPi3:~# python3.5 ITE-bot.py 
Traceback (most recent call last):
  File "ITE-bot.py", line 12, in <module>
    driver = webdriver.Firefox(firefox_options=options)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
    keep_alive=True)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.5/dist-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

知道什么是错的吗?我试过谷歌没有运气.

解决方法:

此错误消息…

selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process

…暗示GeckoDriver无法启动/生成新的WebBrowsing会话,即Firefox浏览器会话.

您的主要问题是您使用的二进制文件版本之间的不兼容性如下:

>您的GeckoDriver版本是0.22.0.
> GeckoDriver v0.21.0(2018-06-15)的发行说明明确提到以下内容:

>

Firefox 57 (and greater)

>

Selenium 3.11 (and greater)

>您的Firefox版本是52.9.0.

因此,GeckoDriver v0.22.0与Firefox浏览器v57之间存在明显的不匹配

>将GeckoDriver升级到GeckoDriver v0.22.0级别.
> GeckoDriver存在于指定位置.
> GeckoDriver拥有非root用户的可执行权限.
>将Firefox版本升级到Firefox v62.0.2级别.
>通过IDE清理Project Workspace,并仅使用所需的依赖项重建项目.
>如果您的基本Web客户端版本太旧,请通过Revo Uninstaller将其卸载并安装最新的GA和已发布的Web客户端版本.
>以非root用户身份执行Selenium Test.

标签:raspberry-pi3,geckodriver,python,firefox,selenium
来源: https://codeday.me/bug/20190916/1807838.html