gpt4 book ai didi

Python,网络驱动程序错误(Selenium)

转载 作者:行者123 更新时间:2023-11-28 21:08:25 24 4
gpt4 key购买 nike

    import time
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome()
driver.get('http://arithmetic.zetamac.com/game?key=a7220a92')
element = driver.find_element_by_link_text('problem')
print(element)

我收到错误:

FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver'

我不确定为什么会这样,因为我已经导入了 selenium。

最佳答案

要么在 webdriver.Chrome 中提供 ChromeDriver 路径,要么提供路径变量

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
driverLocation = 'D:\Drivers\chromedriver.exe' #if windows
driver = webdriver.Chrome(driverLocation)
driver.get('http://arithmetic.zetamac.com/game?key=a7220a92')
element = driver.find_element_by_link_text('problem')
print(element)

关于Python,网络驱动程序错误(Selenium),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39928515/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com