使用Chromedriver运行selenium时,会话未创建错误

时间:2016-10-14 09:25:08

标签: selenium-webdriver selenium-chromedriver

使用Chrome 53.0浏览器运行Selenium 2.53时,会出现如下错误:

org.openqa.selenium.SessionNotCreatedException: session not created exception
from disconnected: Unable to receive message from renderer
 (Session info: chrome=53.0.2785.143)
 (Driver info: chromedriver=2.24.417431 (9aea000394714d2fbb20850021f6204f2256b9cf),platform=Windows NT 10.0.10240 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 3.32 seconds
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:03:33'
System info: host: 'HILP39', ip: '172.16.2.76', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_101'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

虽然相同的Selenium 2.53在Firefox和IE上运行良好。

我使用如下简单代码:

System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\Sel_test1\\sel_test1\\lib\\drivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com");

我使用最新的Chrome驱动程序2.24尝试了最新的Selenium 3.0。我仍然无法解决错误。

有人可以帮忙解决这个阻止错误吗?

1 个答案:

答案 0 :(得分:0)

再次从下面链接

下载最新版本的chromedriver

http://chromedriver.storage.googleapis.com/index.html?path=2.24/

然后尝试使用以下代码

System.setProperty("webdriver.chrome.driver","G:\\ravik\\Ravi-Training\\Selenium\\Drivers\\cd\\chromedriver.exe");
    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    ChromeDriver d1 = new ChromeDriver(capabilities);
    d1.manage().window().maximize();
    d1.get("https://www.google.co.in/?gfe_rd=cr&ei=yXmMV66oLIKEoAPx-ZXQDA");
    String pagetitle=d1.getTitle();

今天我试过了。