相关疑难解决方法(0)

使用Python的Selenium - Geckodriver可执行文件需要在PATH中

我是编程的新手,Python大约2个月前开始使用Python文本,正在浏览Sweigart的自动化无聊的东西.我正在使用IDLE并且已经安装了selenium模块和Firefox浏览器.每当我尝试运行webdriver函数时,我都会得到:

from selenium import webdriver
browser = webdriver.Firefox()
Run Code Online (Sandbox Code Playgroud)

例外: -

Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x00000249C0DA1080>>
Traceback (most recent call last):
  File "C:\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 163, in __del__
    self.stop()
  File "C:\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 135, in stop
    if self.process is None:
AttributeError: 'Service' object has no attribute 'process'
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x00000249C0E08128>>
Traceback (most recent call last):
  File "C:\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 163, in __del__
    self.stop()
  File …
Run Code Online (Sandbox Code Playgroud)

python firefox selenium selenium-firefoxdriver geckodriver

380
推荐指数
17
解决办法
46万
查看次数

在chrome中运行Selenium WebDriver python绑定

我在使用Selenium时遇到了问题.对于我的项目,我必须使用Chrome.但是,在使用Selenium启动它后,我无法连接到该浏览器.

出于某种原因,Selenium无法单独找到Chrome.当我尝试在不包含路径的情况下启动Chrome时会发生这种情况:

Traceback (most recent call last):
  File "./obp_pb_get_csv.py", line 73, in <module>
    browser = webdriver.Chrome() # Get local session of chrome
  File "/usr/lib64/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 46, in __init__
    self.service.start()
  File "/usr/lib64/python2.7/site-packages/selenium/webdriver/chrome/service.py", line 58, in start
    and read up at http://code.google.com/p/selenium/wiki/ChromeDriver")
selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver executable needs to be available in the path.                 Please download from http://code.google.com/p/selenium/downloads/list                and read up at http://code.google.com/p/selenium/wiki/ChromeDriver'
Run Code Online (Sandbox Code Playgroud)

为了解决这个问题,我在启动Chrome的代码中包含了Chromium路径.但是,解释器无法找到要连接的套接字:

Traceback (most recent call last):
  File "./obp_pb_get_csv.py", line 73, in <module>
    browser = webdriver.Chrome('/usr/bin/chromium') # Get local session of …
Run Code Online (Sandbox Code Playgroud)

python linux selenium automated-tests google-chrome

143
推荐指数
5
解决办法
24万
查看次数

SessionNotCreatedException:消息:会话未创建:此版本的 ChromeDriver 仅支持 Chrome 版本 81

我目前是机器人框架的新手。我目前正在使用最新的 chrome 和 chromedriver 窗口版本,它是 80,但是当我尝试运行测试时,它给出消息“SessionNotCreatedException:消息:未创建会话:此版本的 ChromeDriver 仅支持 Chrome pycharm 中的版本 81”,但目前仅提供 81 的测试版。我试过卸载所有东西并重新安装它,但没有任何效果任何人都可以帮助我解决这个问题。谢谢!

截图如下: 1

2

selenium google-chrome robotframework selenium-chromedriver selenium-webdriver

99
推荐指数
9
解决办法
24万
查看次数

selenium - chromedriver可执行文件需要在PATH中

引用错误消息:'chromedriver'可执行文件需要在PATH中

我试图在pycharm中使用selenium编写脚本代码.但后来我得到了上述错误.我已将我的selenium链接到pycharm,如下所示:https://gyazo.com/b5622e3165bbfd93cfa205178df79b6f - (新鲜和最新)

我是selenium的新手,在"selenium"文件夹中不是chromedriver.如果它不在哪里可以找到并将其添加到路径中?

顺便说一句,我尝试在cmd中键入"chromedriver",它不被认为是内部或外部命令.

错误如下所示:

Traceback (most recent call last):
  File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
    stdout=self.log_file, stderr=self.log_file)
  File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
    startupinfo)
PermissionError: [WinError 5] Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/sebastian/PycharmProjects/web/bot.py", line 10, in <module>
    browser = webdriver.Chrome("C:/Users/sebastian/desktop/selenium-3.0.1")
  File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
    self.service.start()
  File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
    os.path.basename(self.path), self.start_error_message) …
Run Code Online (Sandbox Code Playgroud)

python selenium selenium-chromedriver

36
推荐指数
6
解决办法
9万
查看次数

Selenium WebDriver Chrome 115 停止工作

我在 Windows 上安装了 Chrome 115.0.5790.99,并且使用 Selenium 4.10.0。在我的 Python 代码中,我调用service = Service(ChromeDriverManager().install())并返回错误:

ValueError: url [sic] https://chromedriver.storage.googleapis.com/LATEST_RELEASE_115.0.5790没有这样的驱动程序。

我使用 ChromeDriverManager().install() 来确保使用最新稳定版本的 webdriver。如何解决问题?

我的简单代码:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time

# Install Webdriver
service = Service(ChromeDriverManager().install())

# Create Driver Instance
driver = webdriver.Chrome(service=service)

# Get Web Page
driver.get('https://www.crawler-test.com')
time.sleep(5)
driver.quit()
Run Code Online (Sandbox Code Playgroud)

错误输出:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time

# Install Webdriver
service = Service(ChromeDriverManager().install())

# Create …
Run Code Online (Sandbox Code Playgroud)

python google-chrome selenium-webdriver

29
推荐指数
6
解决办法
6万
查看次数

Python Selenium Chrome Webdriver

我开始自动化无聊的东西书,我正在尝试通过python打开一个chrome web浏览器.我已经安装了硒和

我试过运行这个文件:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

browser = webdriver.Chrome()
browser.get('https://automatetheboringstuff.com')
Run Code Online (Sandbox Code Playgroud)

但正因为如此,我得到这个错误:

Traceback (most recent call last):   File "C:\Program Files
   (x86)\Python36-32\lib\site-packages\selenium\webdriver\common\service.py",
 line 74, in start
     stdout=self.log_file, stderr=self.log_file)   File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 707, in __init__
     restore_signals, start_new_session)   File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 990, in _execute_child
     startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified
Run Code Online (Sandbox Code Playgroud)

在处理上述异常期间,发生了另一个异常:

Traceback (most recent call last):   File "C:/Program Files
(x86)/Python36-32/test.py", line 5, in <module>
    browser = …
Run Code Online (Sandbox Code Playgroud)

python selenium selenium-chromedriver

28
推荐指数
2
解决办法
9万
查看次数

使用chromedriver和selenium/python/ubuntu

我正在尝试使用chromedriver执行一些测试,并尝试使用以下方法启动chromedriver.

driver = webdriver.Chrome('/usr/local/bin/chromedriver')
Run Code Online (Sandbox Code Playgroud)

driver = webdriver.Chrome(executable_path='/usr/local/bin/chromedriver')
Run Code Online (Sandbox Code Playgroud)

import os
from selenium import webdriver

chromedriver = "/usr/local/bin/chromedriver"
os.environ["webdriver.chrome.driver"] = chromedriver
driver = webdriver.Chrome(chromedriver)
driver.get("http://stackoverflow.com")
Run Code Online (Sandbox Code Playgroud)

但这些似乎都没有帮助,错误是: selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver executable needs to be available in the path.

我已多次检查并且chromedriver位于现场/usr/local/bin.

我的脚本仍然无效.任何身体都可以帮助.

我的google-chrome位置是:/ usr/bin/google-chrome

python selenium selenium-chromedriver selenium-webdriver

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

如何在Linux中将Chromedriver添加到PATH?

尝试在python脚本中使用Selenium和Chrome.

我收到以下错误:

WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Run Code Online (Sandbox Code Playgroud)

我知道chromedriver可执行文件的位置.如何将其添加到PATH?

谢谢

linux selenium google-chrome

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

如何在 Chrome 浏览器通过 Python selenium 自动更新时使用特定版本的 ChromeDriver

我是Selenium的新人,我现在可以用selenium和Chromedriver做基本的自动测试,代码运行正常,但问题是Chrome浏览器总是在后端自动更新,Chrome更新后代码总是无法运行. 我知道我需要下载新的 chromedriver 来解决这个问题,但我想知道是否有任何方法可以在不禁用 chromebrowser 更新的情况下解决这个问题?tks。

我使用的是 Windows 10 / Chrome 版本 67 / Python 3.6.4 / Selenium 3.12.0

python selenium google-chrome selenium-chromedriver selenium-webdriver

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

Selenium ChromeDriverManager 不下载最新版本的 ChromeDriver

我有一个错误:

E       selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 102
E       Current browser version is 109.0.5414.120 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
Run Code Online (Sandbox Code Playgroud)

我已经使用代码来获取最新版本的 webdriver-

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
options.add_argument("--allow-running-insecure-content")
options.add_argument("--ignore-certificate-errors")
options.set_capability("acceptInsecureCerts", True)

        preferences = {"profile.default_content_settings.popups": 0,
                       "download.default_directory": r""+Constants.path+"",
                       # IMPORTANT - ENDING SLASH V IMPORTANT
                       "directory_upgrade": True}
options.add_experimental_option("prefs", preferences)

driver = webdriver.Chrome(executable_path=ChromeDriverManager().install(), options=options)
Run Code Online (Sandbox Code Playgroud)

使用相同的代码,我可以在本地计算机(即笔记本电脑)上运行此代码,但此代码无法在我的虚拟机上运行。两台机器上的 chrome 版本相同,即 - 109.0.5414.120。

请指导。

google-chrome python-3.x selenium-webdriver webdriver-manager webdrivermanager-python

7
推荐指数
1
解决办法
7734
查看次数

WebDriverException:消息:通过 Selenium Chromedriver python 设置 UserAgent 时,“chromedriver”可执行文件需要在 PATH 中

我是网络抓取的新手,我正在尝试使用以下几行修改我的用户代理:

from selenium import webdriver
chrome_path = r'C:\Users\Desktop\chromedriver_win32\chromedriver.exe'   
driver = webdriver.Chrome(chrome_path)
options = webdriver.ChromeOptions()
options.add_argument('user-agent = Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36')
driver = webdriver.Chrome(chrome_options=options)
Run Code Online (Sandbox Code Playgroud)

环境变量中的路径没问题,但我一直收到此错误消息:

File "C:\Users\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in startstdin=PIPE)
File "C:\Users\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py",line 709, in __init__restore_signals, start_new_session)
File "C:\Users\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py",line 997, in _execute_child startupinfo).
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\safia\AppData\Local\Programs\Python\Python36-32\Test 3- User Agent.py", line 9, in <module>
driver = webdriver.Chrome(chrome_options=options)
File "C:\Users\safia\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 68, in __init__ …
Run Code Online (Sandbox Code Playgroud)

python selenium google-chrome selenium-chromedriver selenium-webdriver

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

selenium.common.exceptions.WebDriverException:消息:“chromedriver”可执行文件需要在 PATH 中

在此处输入图片说明我正在尝试使用 python 和 selenium 自动化我的 Web 应用程序,我面临以下问题。

环境 - Mac/Python/Selenium IDE - PyCharm

selenium.common.exceptions.WebDriverException: 消息:'chromedriver' 可执行文件需要在 PATH 中。请参阅 https://sites.google.com/a/chromium.org/chromedriver/home

请帮我解决这个问题。

python selenium pycharm selenium-chromedriver

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

selenium.common.exceptions.WebDriverException:消息:无头Chrome浏览器的“ chromedriver”可执行文件需要出现PATH错误

当我运行脚本时,出现此错误

Traceback (most recent call last):
  File "C:\Users\ishaq\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
    stdout=self.log_file, stderr=self.log_file)
  File "C:\Users\ishaq\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 707, in __init__
    restore_signals, start_new_session)
  File "C:\Users\ishaq\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 992, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/ishaq/AppData/Local/Programs/Python/Python36/headless.py", line 9, in <module>
    driver = webdriver.Chrome(executable_path=os.path.abspath("chromedriver"),   chrome_options=chrome_options)
  File "C:\Users\ishaq\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
    self.service.start()
  File "C:\Users\ishaq\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: …
Run Code Online (Sandbox Code Playgroud)

python selenium headless selenium-chromedriver google-chrome-headless

3
推荐指数
1
解决办法
5175
查看次数