Chromebook上的Selenium CANT CONT CHOMEDRIVER
Soo,我制作了一个Python脚本,该脚本在Windows机器上使用Selenium,现在我试图在Chromebook上运行它,但是我无法解决如何将Chromedriver用于Chromebook。
这是Python代码:
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException
warnings.filterwarnings("ignore", category=DeprecationWarning)
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(options=options)
driver.get("https://google.com")
它在Windows Machine上的功能非常完美,因为我将Chromedriver作为.py文件中的Chromedriver。
但是,在我的chromebook上的术语中尝试运行python3 myfile.py
我恢复了这个问题:
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver'
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home
这里的任何人都知道如何在Chromebook上解决此问题,Ive尝试下载Chromedriver以for Linux并将其放在我的Linux-Files中,将其放在我的Linux-Files中whit myfile.py.py
Soo i made a python script that uses selenium on my windows machine, now im trying to run it on my chromebook however i cant solve how to get the chromedriver for my chromebook.
Here is the python code:
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException
warnings.filterwarnings("ignore", category=DeprecationWarning)
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(options=options)
driver.get("https://google.com")
it works perfect on my windows machine since i have chromedriver in the samme folder as my .py file.
but when trying to run python3 MyFile.PY
in Termial on my chromebook
i recive this:
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver'
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home
Does any one here know how i can solve this at my chromebook, ive tried downloading chromedriver for linux and placing it in my Linux-files together whit MyFile.PY
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用硒,您必须将Chromedriver.exe保持在路径中。
您可以从
With selenium you have to keep the chromedriver.exe in path.
You can download the chromedriver from https://chromedriver.chromium.org/downloads and put the file in the same folder of the code or you can do:
我也一样。我可以将Chromedriver可执行文件安装到
/usr/usr/local/bin/
中,然后在Python的Chromedriver()构造函数中命名,并观察:这将在Mac上使用。 Chrome& Chromedriver在Chromeos/Debian上。 There's an advice page that maybe deserves extra scrutiny - https://chromedriver.chromium.org/getting- start/chromeos 和出版的包装班 - https://chromium.googlesource.com/chromiumos/third_party/autotest/+/master/client/client/common_lib/cros/cros/chromedriver.py 。这一切都与标准硒相差很大
I get the same. I can install chromedriver executable into
/usr/local/bin/
then name it in the constructor of ChromeDriver() in python, and observe:This would work on the Mac. There's something weird about Chrome & ChromeDriver on ChromeOS/Debian. There's an advice page that maybe deserves extra scrutiny - https://chromedriver.chromium.org/getting-started/chromeos and a published wrapper class - https://chromium.googlesource.com/chromiumos/third_party/autotest/+/master/client/common_lib/cros/chromedriver.py. This all feel quite far diverged from standard Selenium though