学习《python3网络爬虫实战分析》的第七章selenuim库中出现的问题。
错误检索={
1.Warning (from warnings module):
browser = webdriver.Chrome(chrome_options=options)
DeprecationWarning: use options instead of chrome_options
Traceback (most recent call last):
File “D:\python3.8.1\lib\site-packages\selenium\webdriver\common\service.py”, line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File “D:\python3.8.1\lib\subprocess.py”, line 854, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File “D:\python3.8.1\lib\subprocess.py”, line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。
- During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “E:/python爬虫学习文件/第七章.py”, line 14, in
browser = webdriver.Chrome(chrome_options=options)
File “D:\python3.8.1\lib\site-packages\selenium\webdriver\chrome\webdriver.py”, line 73, in init
self.service.start()
File “D:\python3.8.1\lib\site-packages\selenium\webdriver\common\service.py”, line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
3.打开浏览器后出现 不安全|data 的情况(chromedriver放置路径不对或者版本不对)
}
原代码如下
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
browser = webdriver.