[英]org.openqa.selenium.SessionNotCreatedException: session not created disconnected:unable to send message to renderer error with ChromeDriver and Chrome
I try to run this simple program on Java with Selenium:我尝试使用 Selenium 在 Java 上运行这个简单的程序:
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:但是在运行时显示以下错误:
How can i fixed this error ?我怎样才能修复这个错误?
This error message...这个错误信息...
org.openqa.selenium.SessionNotCreatedException: session not created
disconnected: unable to send message to renderer
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser ie Chrome Browser session. ...暗示ChromeDriver无法启动/生成新的WebBrowser,即Chrome 浏览器会话。
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:根据您提供的快照,您正在使用的以下二进制文件集对我来说看起来不错:
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 .根据Unable to receive message from renderer error using chrome driver 2.27另一个潜在原因可能是本地主机中存在防病毒软件,您需要禁用它。
Ensure that /etc/hosts on your system contains the following entry:确保系统上的/etc/hosts包含以下条目:
127.0.0.1 localhost.localdomain localhost #or 127.0.0.1 localhost loopback
Keep Chrome version between Chrome v68-70 levels.将Chrome版本保持在Chrome v68-70级别之间。 ( as per ChromeDriver v2.43 release notes )
(根据 ChromeDriver v2.43 发行说明)
@Test
.@Test
。You can find a related discussion in Automation Testing Error : org.openqa.selenium.WebDriverException: disconnected: unable to connect to renderer您可以在自动化测试错误中找到相关讨论: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 .根据ChromeDriver 2.34 不会等到 iframe 内容在切换到 iframe 后加载,这个问题也在ChromeDriver 2.38和Chrome 67+组合中观察到,并且与静态 iframe (最初加载的 DOM 的一部分)有关,它似乎可以正常工作,直到铬 66 。
Try using JDK 1.8.0_181.尝试使用 JDK 1.8.0_181。 I had the same issue after updating to JDK 1.8.0_191.
更新到 JDK 1.8.0_191 后,我遇到了同样的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.