程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Python Selenium Chrome Webdriver大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决Python Selenium Chrome Webdriver?

开发过程中遇到Python Selenium Chrome Webdriver的问题如何解决?下面主要结合日常开发的经验,给出你关于Python Selenium Chrome Webdriver的解决方法建议,希望对你解决Python Selenium Chrome Webdriver有所启发或帮助;

您需要 。

  1. 从此处下载适用于所需平台的chromedriver。

  2. 将Chromedriver放置在系统路径或代码所在的位置。

  3. 如果不使用系统路径,请链接您的chromedriver.exe(对于非windows用户,简称为Chromedriver):

    browser = webdriver.Chrome(executable_path=r"C:\path\to\chromedriver.exe")
    

(设置executable_path为Chromedriver所在的位置。)

如果您在系统路径上放置了Chromedriver,则可以通过以下操作来实现快捷方式:

browser = webdriver.Chrome()

  1. 如果您在基于Unix的操作系统上运行,则可能需要在下载Chromedriver后更新Chromedriver的权限,以使其可执行:

chmod +x Chromedriver

解决方法

我开始自动化无聊的东西书,并且尝试通过python打开chrome网络浏览器。我已经安装了selenium和

我试图运行此文件:

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')

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

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

Traceback (most recent call last):   File "C:/Program Files
(x86)/Python36-32/test.py",line 5,in <module>
    browser = webdriver.Chrome()   File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py",line 62,in __init__
   self.service.start()   File "C:\Program Files (x86)\Python36-32\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: 'chromedriver'
  executable needs to be in PATH. Please see
https://sites.google.com/a/chromium.org/chromedriver/home

大佬总结

以上是大佬教程为你收集整理的Python Selenium Chrome Webdriver全部内容,希望文章能够帮你解决Python Selenium Chrome Webdriver所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: