我一直在看一段关于selenium I python的freecodecamp视频,他使用的这个方法对我不起作用,我也不明白为什么
class Booking(webdriver.Chrome):
def __init__(self, driver_path=r"C:\SeleniumDrivers"):
self.driver_path = driver_path
os.environ['PATH'] += self.driver_path
super(Booking, self).__init__()
def land_first_page(self):
self.get('https://www.booking.com')
我不确定您是否错过了代码或在视频中错过了-此代码中缺少路径分隔符。因此,当加入路径时,路径分隔符需要存在(例如>;:对于mac和;对于windows),请参考代码中的注释
还要确保chromedriver已下载并复制到C:\SeleniumDrivers
相关问题 更多 >
编程相关推荐