【发布时间】:2021-10-31 18:58:17
【问题描述】:
我正在尝试运行一个 selenium 脚本,但它无法检测到 chromedriver 任何人都可以在我尝试运行它时帮我解决这个问题,它给了我一个错误,指出 chromedriver 在特定路径中不存在但是我已下载并保存在特定路径上 以下是快照和代码供参考。
booking.py
import booking.constants as const
from selenium import webdriver
class Booking(webdriver.Chrome):
def __init__(self , driver_path = "C:\\chromedriver.exe"):
self.driver_path = driver_path
super(Booking, self).__init__()
def land_first_page(self):
self.get(const.BASE_URL)
run.py //在我的编辑器中运行这个python文件
from booking.booking import Booking
inst = Booking()
inst.land_first_page()
【问题讨论】:
-
也许尝试将 chromedriver.exe 移动到桌面并写入确切的路径“C:\Users\Desktop\chromedriver.exe”。
-
得到一个新的错误文件 "c:\Users\Anshul Thakur\Desktop\Selenium Python\Bot\booking\booking.py",第 6 行 def __init__(self , driver_path = "C:\Users \Desktop\chromedriver.exe"): ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape PS C:\Users\Anshul Thakur\Desktop\Selenium Python\Bot >
标签: python selenium selenium-chromedriver undetected-chromedriver