selenium.common.exceptions.SessionNotCreatedException:消息:会话未创建,selenium python
我每一次都有一个问题 基本上这是我的代码:selenium.common.exceptions.SessionNotCreatedException:消息:会话未创建,selenium python,python,python-3.x,selenium,Python,Python 3.x,Selenium,我每一次都有一个问题 基本上这是我的代码: 从selenium导入webdriver 从selenium.webdriver.chrome.options导入选项 选项=选项() options.binary\u location=“C:\Program Files(x86)\Google\Chrome Beta\Application\Chrome.exe” options.add_参数(“--no sandbox”) options.add_参数(“--no default browser
从selenium导入webdriver
从selenium.webdriver.chrome.options导入选项
选项=选项()
options.binary\u location=“C:\Program Files(x86)\Google\Chrome Beta\Application\Chrome.exe”
options.add_参数(“--no sandbox”)
options.add_参数(“--no default browser check”)
options.add_参数(“--no first run”)
options.add_参数(“--disable default apps”)
driver=webdriver.Chrome(options=options,executable\u path=“C:\Program Files(x86)\Google\Chrome Beta\Application\chromedriver.exe”)
司机,上车https://www.youtube.com/')
错误是
selenium.common.exceptions.SessionNotCreatedException:消息:未创建会话
我使用Pycharm并尝试将VS代码与python 3.4、3.7和3.8.3结合使用
请帮帮我,我已经厌倦了
完整错误日志:
Traceback (most recent call last):
File "C:/Users/um/PycharmProjects/Selenium/main.py", line 10, in <module>
driver = webdriver.Chrome(options=options, executable_path="C:\Program Files (x86)\Google\Chrome Beta\Application\chromedriver.exe")
File "C:\Users\um\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in __init__
RemoteWebDriver.__init__(
File "C:\Users\um\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\um\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\um\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\um\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created
from disconnected: unable to send message to renderer
(Session info: chrome=81.0.4044.83)
回溯(最近一次呼叫最后一次):
文件“C:/Users/um/PycharmProjects/Selenium/main.py”,第10行,在
driver=webdriver.Chrome(options=options,executable\u path=“C:\Program Files(x86)\Google\Chrome Beta\Application\chromedriver.exe”)
文件“C:\Users\um\AppData\Local\Programs\Python38-32\lib\site packages\selenium\webdriver\chrome\webdriver.py”,第76行,在\uuu init中__
RemoteWebDriver.\uuu init__(
文件“C:\Users\um\AppData\Local\Programs\Python38-32\lib\site packages\selenium\webdriver\remote\webdriver.py”,第157行,在\uuu init中__
启动会话(功能、浏览器配置文件)
文件“C:\Users\um\AppData\Local\Programs\Python38-32\lib\site packages\selenium\webdriver\remote\webdriver.py”,第252行,在启动会话中
响应=self.execute(Command.NEW_会话,参数)
文件“C:\Users\um\AppData\Local\Programs\Python38-32\lib\site packages\selenium\webdriver\remote\webdriver.py”,执行中第321行
self.error\u handler.check\u响应(响应)
文件“C:\Users\um\AppData\Local\Programs\Python38-32\lib\site packages\selenium\webdriver\remote\errorhandler.py”,第242行,在check\u响应中
引发异常类(消息、屏幕、堆栈跟踪)
selenium.common.exceptions.SessionNotCreateException:消息:未创建会话
从已断开连接:无法将消息发送到渲染器
(会话信息:chrome=81.0.4044.83)
您的错误不存在
无法将消息发送到渲染器
正如你提到的。根据堆栈跟踪,你在第6行发布了问题
driver=webdriver.Chrome(options=options,executable_path=“chromedriver.exe”)
问题是:
selenium.common.exceptions.SessionNotCreatedException:消息:未创建会话
似乎您指定的chromedriver路径无效,Selenium无法初始化驱动程序并创建会话。
你也应该。
您可以下载有效版本(我已从stacktrace获取了您的Chrome版本)。您的错误不存在
无法将消息发送到渲染器
正如你提到的。根据堆栈跟踪,你在第6行发布了问题
driver=webdriver.Chrome(options=options,executable_path=“chromedriver.exe”)
问题是:
selenium.common.exceptions.SessionNotCreatedException:消息:未创建会话
似乎您指定的chromedriver路径无效,Selenium无法初始化驱动程序并创建会话。
你也应该。
您可以下载有效版本(我从stacktrace获取了您的Chrome版本).是的,它确实是以上面的错误日志开始然后关闭的,而且我有正确的版本是的,它确实是以上面的错误日志开始然后关闭的,而且我有正确的版本,所以a会首先说谢谢你给我宝贵的时间,我已经更改了问题中的代码,同样的事情发生了吗你真的看到Chrome是在代码执行时启动的吗?那么a会首先说谢谢你给我宝贵的时间,我在问题中更改了我的代码,同样的事情也发生了。你真的看到Chrome是在代码执行时启动的吗?