Selenium:ValueError:超时值connect为<object object at 0x0000020E14D886D0>,但必须是int、float或None。(python)
from selenium import webdriver
def openDriver():
global driver
geckodriver_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'geckodriver.exe')
driver = webdriver.Firefox(executable_path=geckodriver_path)
driver.get('https://google.com/')
return driver
def main():
driver= openDriver()
if __name__ == '__main__':
main()
我在使用selenium版本3.141.0的时候,urllib3的版本是2.2.1。当我运行一个应该能识别py路径的脚本时,出现了执行错误。后来我在另一个问题中看到,可能是selenium或urllib3的版本问题。看起来是使用executable_path时,Selenium的特定版本出了问题。
1 个回答
0
需要把urllib3的版本降到v1.26.18,这样它才能识别当前目录的路径。
我确认在版本4.18.1中,默认情况下,它已经能通过driver = webdriver.Firefox()来识别路径了。