首页新闻找找看学习计划

python selenium line 174, in __init__keep_alive=True

0
[待解决问题]

代码如下
from selenium import webdriver
from time import sleep
driver=webdriver.Firefox()
driver.get("http://www.51zxw.net")
print(driver.title)
sleep(3)

driver.get("http://www.baidu.com")
print(driver.title)
sleep(2)
运行报错
C:\Python35\python.exe E:/Python_script/webdriver/open_wyzxw.py
Traceback (most recent call last):
File "E:/Python_script/webdriver/open_wyzxw.py", line 3, in <module>
driver=webdriver.Firefox()
File "C:\Python35\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 174, in init
keep_alive=True)
File "C:\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in init
self.start_session(capabilities, browser_profile)
File "C:\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Python35\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidSessionIdException: Message:

尚市桃的主页 尚市桃 | 菜鸟二级 | 园豆:202
提问于:2018-09-27 10:44

driver=webdriver.Firefox() 启动器位置不对 是不是忘记传位置了

wow2828 1年前

@wow2828: 啊,那应该加在哪里呀,我不是很懂,请帮帮忙

尚市桃 1年前

@尚市桃: https://blog.csdn.net/u011541946/article/details/64129041 看下你是不是忘记下载火狐浏览器的 webdriver插件了

wow2828 1年前

@尚市桃: 你有自学网的视频吗

wow2828 1年前
< >
分享
所有回答(1)
0

opt = webdriver.FirefoxOptions()
driver = webdriver.Firefox(options=opt)
把对应的火狐driver放置path路径下

自说自话唉 | 园豆:193 (初学一级) | 2018-09-28 14:10
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册