如何在使用 selenium 的程序上使用 auto-py-to-exe? - Chromedriver 路径错误

发布于 2025-01-14 09:27:46 字数 602 浏览 3 评论 0原文

有谁知道如何在使用 selenium 的程序上使用 auto-py-to-exe ?

我已经处理这个问题几个小时了 我得到:

selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home

这是我的代码:

PATH = r'driver\chromedriver.exe'

op = webdriver.ChromeOptions()
op.add_argument('headless')
op.add_argument('--no-sandbox')
op.add_argument('--disable-dev-shm-usage')
global driver
driver = webdriver.Chrome(PATH, options=op)

它说 chromedriver.exe 不在路径中,但它是?我做错了什么? 我遵循了很多转移注意力的教程,但没有用,我快要为此失去理智了。

Does anyone know how I can use auto-py-to-exe on a program that uses selenium?

I've been dealing with this for a few hours,
I'm getting:

selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home

This is my code:

PATH = r'driver\chromedriver.exe'

op = webdriver.ChromeOptions()
op.add_argument('headless')
op.add_argument('--no-sandbox')
op.add_argument('--disable-dev-shm-usage')
global driver
driver = webdriver.Chrome(PATH, options=op)

It says the chromedriver.exe isn't in the path, but it is?? What am I doing wrong?
I've followed so many red-herring tutorials that didn't work and I'm about to lose my mind over this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

燕归巢 2025-01-21 09:27:46

因此,我必须将 chromedriver 与 .exe 文件或 C:\driver\chromedriver.exe 之类的位置放在一起,以便可以从我计算机上的任何位置访问它。

So, I had to place chromedriver with the .exe file or somewhere like C:\driver\chromedriver.exe so it could be accessible from anywhere on my computer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文