当前位置: 首页 > 面试题库 >

SessionNotCreatedException:消息:会话未从断开连接创建:无法使用ChromeDriver 2.45 Chrome v71连接到渲染器

毛弘博
2023-03-14
问题内容

当我使用Python使用Selenium执行此代码时:

from selenium import webdriver
from selenium.webdriver.common.by import By
import time
driver = webdriver.Chrome(executable_path=r'/Users/qa/Documents/Python/chromedriver')

发生错误:

   Traceback (most recent call last):
  File "/Users/qa/Documents/Python/try.py", line 4, in <module>
    driver = webdriver.Chrome(executable_path=r'/Users/qa/Documents/Python/chromedriver')
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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 connect to renderer
  (Session info: chrome=71.0.3578.98)
  (Driver info: chromedriver=2.44.609545 (c2f88692e98ce7233d2df7c724465ecacfe74df5),platform=Mac OS X 10.13.6 x86_64)

有人能帮我吗?谢谢。


问题答案:

此错误消息…

selenium.common.exceptions.SessionNotCreatedException: Message: session not created
from disconnected: unable to connect to renderer

…暗示 ChromeDriver 无法启动/产生新的 WebBrowser,Chrome浏览器 会话。

您需要考虑一个事实:

  • 当您使用 Mac OS X时密钥 executable_path必须受以下 支持:

    '/Users/qa/Documents/Python/chromedriver'
    
  • 因此,行将是:

    driver = webdriver.Chrome(executable_path='/Users/qa/Documents/Python/chromedriver')
    

注意路径 本身是原始路径,因此您无需添加r和删除开关。

此外,请确保/etc/hosts您的系统上包含以下条目:

127.0.0.1 localhost.localdomain localhost
#or
127.0.0.1 localhost loopback


 类似资料:
  • 问题内容: 元- 作业系统:OSX 10.12.6(16G29) 浏览器: Chrome版本62.0.3202.62(正式版本)(64位) 浏览器版本: 62.0.3202.62(正式版本)(64位) 预期行为- Chrome会话应开始,脚本应执行到结束 实际行为- 浏览器已启动,但脚本立即崩溃。 码: 问题答案: 您正在使用chromediver 2.32,并且在发行说明中写道,该支持是针对 C

  • 我正在尝试使用快速连接将JProfiler(10.0.1)连接到JMX端口- “另一个应用程序正在端口19002上运行。请检查您的端口配置”。 我使用的是oracle JDK jdk1.8.0_181。下面是我用于服务器启动的JXM选项。

  • 问题内容: 我正在尝试从某个门户网站获取交易状态,并且在我的Java应用程序中使用了以下chrome设置, 超时从渲染器接收消息:60.000 并且所有待处理的交易都已超时。 会话信息:headless chrome = 68.0.3440.75 驱动程序信息: chromedriver = 2.38 (0) 平台= Linux 2.6.32-696.23.1.el6.x86_64 x86_64)

  • 我有一个有状态的会话bean,我在那里发送和接收JMS消息。所有的连接设置都是手动处理的,因此bean包含javax.jms.connection和javax.jms.Session的实例。该bean还实现了MessageListener,使其能够接收消息。 注意:这是在Java EE环境(GlassFish4.0)中执行的 编辑:

  • 我试图从一些门户网站获取交易状态,我在我的java应用程序中使用下面的chrome设置 从渲染器接收消息时超时:60.000 所有悬而未决的交易都在超时。 会话信息:headless chrome=68.0.3440.75 驱动程序信息:chromedriver=2.38(0) 平台=Linux 2.6.32-696.23.1。el6。x86_64 x86_64) 我如何处理这个问题,如果发生任何

  • 我有一个批处理作业,它将一天触发一次。要求是 使用该时间点上关于Kafka主题的所有可用消息 处理消息 如果进程已成功完成,则提交偏移量。 当前,我poll()while循环中的消息,直到ConsumerRecords.isEmpty()为true。当ConsumerRecords.isEmpty()为true时,我假设Topic在该时间点的所有可用记录都已被使用。应用程序维护偏移量并关闭kafk