相关疑难解决方法(0)

DeprecationWarning:executable_path 已被弃用 selenium python

我正在使用 sublime 来编写 python 脚本。以下代码是python中selenium使用webdriver_manager包自动安装驱动

# pip install webdriver-manager
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By

driver = webdriver.Chrome(ChromeDriverManager().install())
driver.maximize_window()

#s=Service(path)
#driver=webdriver.Chrome(service=s)
driver.get('https://www.google.com')
driver.find_element(By.NAME, 'q').send_keys('Yasser Khalil')
Run Code Online (Sandbox Code Playgroud)

代码工作正常,但我收到了这样的警告

Demo.py:7: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  driver = webdriver.Chrome(ChromeDriverManager().install())
Run Code Online (Sandbox Code Playgroud)

如何修复这样的错误?

python selenium

201
推荐指数
7
解决办法
45万
查看次数

错误消息:"'chromedriver'可执行文件需要在路径中可用"

我正在使用selenium和python,并从我的网站下载了我的Windows计算机的chromedriver:http://chromedriver.storage.googleapis.com/index.html?path = 2.15 /

下载zip文件后,我将zip文件解压缩到我的下载文件夹.然后我将路径到可执行二进制文件(C:\ Users\michael\Downloads\chromedriver_win32)放入环境变量"路径".

但是,当我运行以下代码时:

  from selenium import webdriver

  driver = webdriver.Chrome()
Run Code Online (Sandbox Code Playgroud)

...我一直收到以下错误消息:

WebDriverException: Message: 'chromedriver' executable needs to be available in the path. Please look at     http://docs.seleniumhq.org/download/#thirdPartyDrivers and read up at http://code.google.com/p/selenium/wiki/ChromeDriver
Run Code Online (Sandbox Code Playgroud)

但是 - 如上所述 - 可执行文件是(!)在路径中...这里发生了什么?

python selenium selenium-chromedriver

126
推荐指数
11
解决办法
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使用chrome驱动程序

我在使用适用于Selenium的Chrome驱动程序时遇到问题.我已将chromedriver下载并保存到C:\ Chrome:

driver = webdriver.Chrome(executable_path="C:/Chrome/")
Run Code Online (Sandbox Code Playgroud)

使用它给我以下错误:

Traceback (most recent call last):
  File "C:\Python33\lib\subprocess.py", line 1105, in _execute_child
    startupinfo)
PermissionError: [WinError 5] Access is denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python33\lib\site-packages\selenium\webdriver\chrome\service.py", line 63, in start
    self.service_args, env=env, stdout=PIPE, stderr=PIPE)
  File "C:\Python33\lib\subprocess.py", line 817, in __init__
    restore_signals, start_new_session)
  File "C:\Python33\lib\subprocess.py", line 1111, in _execute_child
    raise WindowsError(*e.args)
PermissionError: [WinError 5] Access is denied

During handling of the above exception, another exception occurred:

Traceback …
Run Code Online (Sandbox Code Playgroud)

python selenium google-chrome python-3.x python-3.3

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