org.openqa.selenium.SessionNotCreatedException:未创建会话已断开连接:无法使用ChromeDriver和Chrome将消息发送到渲染器错误 [英] org.openqa.selenium.SessionNotCreatedException: session not created disconnected:unable to send message to renderer error with ChromeDriver and Chrome

查看:1924
本文介绍了org.openqa.selenium.SessionNotCreatedException:未创建会话已断开连接:无法使用ChromeDriver和Chrome将消息发送到渲染器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Selenium在Java上运行此简单程序:

I try to run this simple program on Java with Selenium:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;


public class MySelenium {

    public static void main(String[] args) {
        System.out.println("First Selenium");
        System.setProperty("webdriver.chrome.driver", "C:\\automation\\drivers\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.get("https://www.seleniumhq.org/");
        driver.quit();              
    }
}

但是在运行时显示以下错误:

But on running shows the following error:

如何解决此错误?

推荐答案

此错误消息...

org.openqa.selenium.SessionNotCreatedException: session not created 
disconnected: unable to send message to renderer

...表示 ChromeDriver 无法启动/产生新的 WebBrowser ,即 Chrome浏览器会话.

...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.

我怀疑您的主要问题是所使用的二进制文件版本之间的不兼容性.

I suspect your main issue is the incompatibility between the version of the binaries you are using.

根据快照,您提供了以下正在使用的二进制文件集:

As per the snapshot you have provided the following set of binaries you are using looks fine to me:

  • JDK : 1.8.0_191
  • : 3.14.0
  • ChromeDriver : 2.43
  • Chrome : 69.0
  • JDK: 1.8.0_191
  • Selenium: 3.14.0
  • ChromeDriver: 2.43
  • Chrome: 69.0
  • As per Unable to receive message from renderer error using chrome driver 2.27 another pottential reason can be presence of antivirus within your localhost which you need to disable.

确保系统上的/etc/hosts 包含以下条目:

Ensure that /etc/hosts on your system contains the following entry:

127.0.0.1 localhost.localdomain localhost
#or
127.0.0.1 localhost loopback

  • Chrome 版本保持在 Chrome v68-70 级别之间. (根据ChromeDriver v2.43发行说明)

  • Keep Chrome version between Chrome v68-70 levels. (as per ChromeDriver v2.43 release notes)

    您可以在自动化测试错误:org中找到相关的讨论. openqa.selenium.WebDriverException:断开连接:无法连接到渲染器

    根据

    As per ChromeDriver 2.34 doesn't wait until iframe content loads after switching into iframe this issue was also observed with ChromeDriver 2.38 and Chrome 67+ combo and was related to static iframes (part of the originally loaded DOM) which seem to work correctly even till Chrome 66.

    这篇关于org.openqa.selenium.SessionNotCreatedException:未创建会话已断开连接:无法使用ChromeDriver和Chrome将消息发送到渲染器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆