Meta -
操作系统:OSX 10.12.6(16G29)
~./node_modules/chromedriver/bin/chromedriver -v
ChromeDriver 2.32.498537 (cb2f855cbc7b82e20387eaf9a43f6b99b6105061)
~ $ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7/Contents/Home
~ $ node -v
v6.11.2
浏览器:
Chrome版本62.0.3202.62(官方版本)(64位)
浏览器版本:
62.0.3202.62(官方建设)(64位)
预期行为 -
Chrome会话应该开始,脚本应该执行到最后
实际行为 -
浏览器已启动,但脚本崩溃了。
代码:
> ucb-client@2.97.3 selenium-local /Users/Georgios/Development/rocket-internet/ucb-client
> node test/automation-tests/testcases/happy-path/Local_Guest_Cash.js
/Users/Georgios/Development/rocket-internet/ucb-client/node_modules/selenium-webdriver/lib/promise.js:2634
throw error;
^
WebDriverError: disconnected: unable to connect to renderer
(Session info: chrome=62.0.3202.62)
(Driver info: chromedriver=2.32.498537 (cb2f855cbc7b82e20387eaf9a43f6b99b6105061),platform=Mac OS X 10.12.6 x86_64)
at WebDriverError (/Users/Georgios/Development/rocket-internet/ucb-client/node_modules/selenium-webdriver/lib/error.js:27:5)
at Object.checkLegacyResponse (/Users/Georgios/Development/rocket-internet/ucb-client/node_modules/selenium-webdriver/lib/error.js:529:15)
at parseHttpResponse (/Users/Georgios/Development/rocket-internet/ucb-client/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/Users/Georgios/Development/rocket-internet/ucb-client/node_modules/selenium-webdriver/lib/http.js:441:30)
at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.manage().window().setSize(1280, 720)
at thenableWebDriverProxy.schedule (/Users/Georgios/Development/rocket-internet/ucb-client/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
at Window.setSize (/Users/Georgios/Development/rocket-internet/ucb-client/node_modules/selenium-webdriver/lib/webdriver.js:1677:25)
at Object.<anonymous> (/Users/Georgios/Development/rocket-internet/ucb-client/test/automation-tests/testcases/happy-path/Local_Guest_Cash.js:8:26)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
Actual script (beginning)
require('chromedriver');
var webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
var driver = new webdriver.Builder().forBrowser('chrome').build();
var timeout = 15000;
答案 0 :(得分:31)
您正在使用chromediver 2.32并在release notes中写道支持适用于 Chrome v59-61
作为浏览器:
Chrome Version 62.0.3202.62 (Official Build) (64-bit)
因此,从ChromeDriver开始,你应该使用2.33
答案 1 :(得分:21)
我有类似的错误。但版本匹配:我使用的是Chrome 65,驱动程序版本为2.38。
我花了很长时间,试图理解这个问题。
最后,发现它是由空/etc/hosts
文件引起的。显然,Chrome通过localhost
进行通信,如果/etc/hosts
中缺少此类条目,则会崩溃。
所以,请确保它有这样的条目:
127.0.0.1 localhost
答案 2 :(得分:1)
这是@ davide-patti解决方案的brew
附录。 :)
当我收到错误unable to connect to renderer
时,我从中学习
@ davide-patti我使用的是较旧版本的chromedriver,v2.32。但我无法将chromedriver
升级为主brew
,因为我不断收到:No available formula with the name "chromedriver"
。
本文帮助我升级到v2.33 +。
关于:错误:没有名为“chromedriver”的可用公式 https://github.com/Homebrew/brew/issues/4089
答案 3 :(得分:0)
这是因为页面加载时间较长,您需要在脚本中添加其他行
System.setProperty("webdriver.chrome.driver","E:\\selenium\\chromedriver_2.41\\chromedriver.exe");
//mention the below chrome option to solve timeout exception issue
ChromeOptions options = new ChromeOptions();
options.setPageLoadStrategy(PageLoadStrategy.NONE);
// Instantiate the chrome driver
driver = new ChromeDriver(options);