简体   繁体   English

如何使用 selenium 镀铬选项?

[英]How to use selenium chrome options?

So I have had this code for sometime that worked without an issue for what I can recall.所以我已经有一段时间的这段代码了,我能回忆起它没有问题。 However, it has recently been raising an issue when I run it.但是,它最近在我运行它时引发了一个问题。 Here is the code这是代码

chrome_options = Options()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')

driver = webdriver.Chrome(options=chrome_options)

here is the error这是错误

selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH.

First, you need to install ChromeDriver if it's not installed.首先,如果未安装 ChromeDriver,则需要安装它。 ( https://chromedriver.chromium.org/downloads ) https://chromedriver.chromium.org/downloads

Then, you need to add it to the PATH environment variable and you're good to go!然后,您需要将其添加到 PATH 环境变量中,一切顺利!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在'desiredCapabilities'中添加selenium chrome选项? - How to add selenium chrome options to 'desiredCapabilities'? Selenium Chrome选项和功能 - Selenium Chrome Options and Capabilities 弃用警告:在 Windows 10 系统上通过 Selenium 使用 ChromeDriver 和 Chrome 使用选项而不是 chrome_options 错误 - DeprecationWarning: use options instead of chrome_options error using ChromeDriver and Chrome through Selenium on Windows 10 system 如何使用 selenium.webdriver.firefox.options? - How to use selenium.webdriver.firefox.options? selenium 镀铬选项(在后台运行) - selenium chrome options (running in backgroud) 如何使用 Python 将选项传递给 Selenium Chrome 驱动程序? - How do I pass options to the Selenium Chrome driver using Python? 如何在 Python 中使用类将选项传递给 Selenium Chrome 驱动程序? - How to pass options to the Selenium Chrome driver using class in Python? 如何将 chrome-options 传递到 selenium-requests - How to pas chrome-options into selenium-requests 弃用警告:在 Python Selenium 和 Windows 上使用 Brave 浏览器时使用选项而不是 chrome_options 错误 - DeprecationWarning: use options instead of chrome_options error using Brave Browser With Python Selenium and Chromedriver on Windows 如何在Selenium中为Python使用预定义的Chrome配置文件? - How to use predefined chrome profile in selenium for python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM