这是我的密码。你知道吗
from selenium import webdriver
chrome_options = webdriver.ChromeOptions();
chrome_options.add_experimental_option("excludeSwitches", ['enable-automation']);
options = webdriver.Chrome(options=chrome_options)
options.get('https://www.google.com/')
images = options.find_elements_by_tag_name('img')
for image in images:
print(image.get_attribute('src'))
options.close()
当我运行这个代码时,我得到了这个错误
**Traceback (most recent call last):
Python\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "Python\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "Python\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified**
请检查我是否在代码中有任何错误,或者如果你理解这个错误,请告诉我 谢谢
首先从https://link.jianshu.com/?t=https://sites.google.com/a/chromium.org/chromedriver/下载并安装浏览器驱动程序 解压并将其放入类似“browserdriver”的目录中,然后按以下方式更改代码:
在声明驱动程序时,需要将路径添加到chrome驱动程序。你知道吗
相关问题 更多 >
编程相关推荐