from selenium import webdriver
from selenium.webdriver.chrome.service import Service
try:
# browser = webdriver.Chrome('这里填chrome的路径')
s = Service(r"/opt/apps/cn.google.chrome/files/chrome")
driver = webdriver.Chrome(service=s)
driver.get('https://www.baidu.com')
except Exception as e:
print(e)
运行这个代码时,报错,需要将chrome文件与chromedriver放到同一个目录下
把路径添加进去即可