Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

selenium - WebDriverError: disconnected: unable to connect to renderer

Meta -

OS: 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

Browser:

Chrome Version 62.0.3202.62 (Official Build) (64-bit)

Browser Version:

62.0.3202.62 (Official Build) (64-bit)

Expected Behavior -

A Chrome session should start and the script should execute till the end

Actual Behavior -

The browser is started but the script immedialy crashes.

Code:

> 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;
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had similar error. But versions were matching: I was using Chrome 65 with driver version 2.38.

I spent long time, trying to understand the issue. At the end, found that it was caused by empty /etc/hosts file. Apparently Chrome communicates via localhost, and if such entry missing in /etc/hosts - it will crash.

So, make sure, it has entry like this:

127.0.0.1 localhost


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...