相关疑难解决方法(0)

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

服务器:Raspberry Pi 3
OS:Dietpi - 版本159
Geckodriver版本:0.22 for arm
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')
...
...
Run Code Online (Sandbox Code Playgroud)

输出:

root@RPi3:~# python3.5 ITE-bot.py 
Traceback (most recent call last):
  File "ITE-bot.py", line 12, in <module>
    driver …
Run Code Online (Sandbox Code Playgroud)

python firefox selenium raspberry-pi3 geckodriver

16
推荐指数
5
解决办法
3万
查看次数

InvalidArgumentException:消息:使用 GeckoDriver Firefox Selenium 和 Python 时,二进制文件不是 Firefox 可执行文件错误

我遇到了与 FireFox 二进制文件相关的硒错误。

我使用反斜杠将 C:/Users/Mack/AppData/Local/Programs/Python/ 添加到 PATH 并重新启动。我在这里下载了我认为正确的文件https://github.com/mozilla/geckodriver/releases 我将该文件放在连接到 PATH 的目录中。

为了解决这个问题:我尝试使用两个反斜杠

binary = FirefoxBinary("C:\\Users\Mack\AppData\Local\Programs\Python\Python38-32\geckodriver-v0.27.0-win64\geckodriver.exe")
Run Code Online (Sandbox Code Playgroud)

这会引发相同的错误

我尝试使用一个反斜杠

binary = FirefoxBinary("C:\Users\Mack\AppData\Local\Programs\Python\Python38-32\geckodriver-v0.27.0-win64\geckodriver.exe")
Run Code Online (Sandbox Code Playgroud)

这会抛出:

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
Traceback (most recent call last):
  File "C:\Users\Mack\Desktop\hacker-stories\Trends.py", line 32, in <module>
    browser = webdriver.Firefox(**firefox_binary=binary**)
  File "C:\Users\Mack\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 170, in __init__
    RemoteWebDriver.__init__(
  File "C:\Users\Mack\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\Mack\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\Mack\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, …
Run Code Online (Sandbox Code Playgroud)

python firefox selenium selenium-webdriver geckodriver

8
推荐指数
2
解决办法
3万
查看次数

WebDriverException:消息:进程意外关闭并带有状态信号 | 如何在 Google Colaboratory 中运行 Selenium Firefox Geckodriver?

嘿 stackoverflow 社区,我想在 google recolab 中使用 firefox geckodriver 为 python 运行 selenium。我最近发现了一篇关于这个主题的帖子,其中有@DebanjanB不久前的答案: https: //stackoverflow.com/a/57553986/15163882。遗憾的是,提供的解决方案不再有效,我不知道如何修复它。

这是 stackoverflow 答案中的代码,应该下载并运行 geckodriver;

# install firefox, geckodriver, and selenium
!apt-get update
!pip install selenium
!apt install firefox-geckodriver
!cp /usr/lib/geckodriver /usr/bin
!cp /usr/lib/firefox /usr/bin

from selenium import webdriver

binary = '/usr/bin/firefox'
options = webdriver.FirefoxOptions()
options.binary = binary
options.add_argument('start-maximized')
options.add_argument('--headless')
browser = webdriver.Firefox(firefox_options=options, executable_path='/usr/bin/geckodriver')
browser.get('http://google.com/')
Run Code Online (Sandbox Code Playgroud)

!cp /usr/lib/geckodriver /usr/bin结果出错,没有这样的文件,geckodriver 存储在/usr/bin/geckodriver. !cp /usr/lib/firefox /usr/bin也不起作用,/usr/lib/firefox是目录,而不是文件。总的来说,代码失败了,但有以下例外:Process unexpectedly closed with status signal …

firefox selenium selenium-webdriver geckodriver google-colaboratory

6
推荐指数
1
解决办法
4334
查看次数

Python Selenium:'意外的关键字参数'executable_path'

我刚刚开始使用seleniumPython,并且不断收到以下错误代码:

TypeError: WebDriver.__init__() got an unexpected keyword argument 'executable_path'
Run Code Online (Sandbox Code Playgroud)

这是上下文的代码:

from selenium.webdriver import Firefox
from selenium.webdriver.common.keys import Keys

url = 'https://example'
driver_path = r"D:\path\to\geckodriver.exe"

browser = Firefox(executable_path=driver_path)
browser.get(url)
Run Code Online (Sandbox Code Playgroud)

提前致谢!

我检查了路径、selenium包的版本并确保我有正确的geckodriver.exe但仍然收到错误。

python firefox selenium-webdriver

4
推荐指数
1
解决办法
6114
查看次数