Selenium in "HeadLess" mode "Runtime.executionContextCreated has invalid 'context'" on Vagrant [duplicate] - python-3.x

I'm trying to get started using selenium and have downloaded a chrome driver and put into my classpath. I'm just trying to get the title right now to see if I can get it to work. Code currently looks like this:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Flows {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "/Users/mn/Desktop/project/turv/src/main/chromedriver");
WebDriver driver = new ChromeDriver();
String baseUrl = "http://google.dk/";
driver.get(baseUrl);
System.out.println(driver.getTitle());
driver.close();
}
}
I expected my output to be something along the lines of "Google", but I get this error instead:
Connected to the target VM, address: '127.0.0.1:55299', transport: 'socket'
Starting ChromeDriver (v2.8.241036) on port 2571
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
May 07, 2018 12:12:35 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Disconnected from the target VM, address: '127.0.0.1:55299', transport: 'socket'
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"11895A1B77AC560388AA2919259E1422","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=66.0.3359.139)
(Driver info: chromedriver=2.8.241036,platform=Mac OS X 10.13.3 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: 'cetreas-MBP', ip: 'fe80:0:0:0:c9e:2c67:1d27:4e0b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.3', java.version: '1.8.0_161'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptSslCerts: true, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {userDataDir: /var/folders/s7/lv2wt4t15cn...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, javascriptEnabled: true, locationContextEnabled: true, nativeEvents: true, platform: MAC, platformName: MAC, rotatable: false, takesHeapSnapshot: true, takesScreenshot: true, version: 66.0.3359.139, webStorageEnabled: true}
Session ID: ca1f4ba131e73c3d01058bec2b976d22
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:273)
at com.cetrea.flows.Flows.main(Flows.java:15)
I cant really figure out what the error is trying to tell me. Is it because I'm asking for the title before it has fully loaded the site maybe? Do I need to add some kind of waitforit command before the getTitle() ?

This error message...
org.openqa.selenium.WebDriverException: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"11895A1B77AC560388AA2919259E1422","isDefault":true},"id":1,"name":"","origin":"://"}
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
Your main issue is the version compatibility between the binaries you are using as follows :
You are using chromedriver=2.8 which is pretty ancient.
You are using chrome=66.0
Release Notes of ChromeDriver v2.38 clearly mentions the following :
Supports Chrome v65-67
So there is a clear mismatch between ChromeDriver version (v2.8) and the Chrome Browser version (v66.0)
Solution
Upgrade ChromeDriver to current ChromeDriver v2.38 level.
Keep Chrome version at Chrome v66.x levels. (as per ChromeDriver v2.38 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

Related

Selenium Error: "org.openqa.selenium.WebDriverException: Error loading page"

I keep running into this error when using a tool that attempts to load a locally-saved web page via Selenium, gekodriver, and firefox.
Versions utilized:
Selenium: 3.0.1
Gekodriver: 13.0
Firefox: 46.0
My constraints are that I have to use selenium 3.0.1, but the other dependencies can be altered. Has anybody run into this issue before?
1676503488636 geckodriver INFO Listening on 127.0.0.1:12651
Feb 15, 2023 3:24:48 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1676503488712 mozprofile::profile INFO Using profile path /tmp/rust_mozprofile.gQ6hEnrnMxIC
1676503488713 geckodriver::marionette INFO Starting browser /home/robert/firefox/firefox-bin
1676503488714 geckodriver::marionette INFO Connecting to Marionette on localhost:36313
1676503489262 Marionette INFO Listening on port 36313
Feb 15, 2023 3:24:50 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
org.openqa.selenium.WebDriverException: Error loading page
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'robert-XPS-8700', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-58-generic', java.version: '1.8.0_202'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, marionette=true, firefoxOptions={args=[], prefs={}}, appBuildId=20160421124000, version=, platform=LINUX, proxy={}, specificationLevel=1, acceptSslCerts=false, browserVersion=46.0, platformVersion=5.15.0-58-generic, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=Firefox, takesScreenshot=true, takesElementScreenshot=true, platformName=Linux, device=desktop}]
Session ID: 918b2a1b-0b33-4acf-ae5a-8545c55ad0d9
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:127)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:93)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:42)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:322)
at shef.main.RLGExtractor.extract(RLGExtractor.java:105)
at shef.main.Tool.runFaultDetector(Tool.java:185)
at shef.main.Tool.<init>(Tool.java:136)
at shef.main.Tool.main(Tool.java:417)
As per the geckodriver specifications Selenium users must update to version 3.11 or later to use geckodriver like other clients that follow the W3C WebDriver specification and are also supported.
Additionally, support for GeckoDriver is best in Firefox 57 and greater, however the more recent the Firefox version, the better the experience as they contain more bug fixes and the recent features while some features will only be available in the latest Firefox Nightly with GeckoDriver.
This usecase
If you are working with the legacy Firefox releases (i.e. till Firefox 47.x) geckodriver still works but you have to explicitly set the property "marionette" to false as follows:
cap = DesiredCapabilities().FIREFOX
cap["marionette"] = False

Is it possible to use selenium on an arm64 device which has a linux server?

I'm trying to run selenium on an arm64 device with linux server, since I cannot install chrome on this device, I want to use chromium or firefox browser in headless mode. But I'm getting different errors every time I run my selenium program. here is the error log while using chromium:
/root/.cache/selenium/chromedriver/linux-arm64/101.0.4951.41/chromedriver: 1: Syntax error: "(" unexpected
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:585)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:248)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:164)
at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:108)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:106)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:93)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:82)
at dev.emad.selenium.book.Main$Companion.main(Main.kt:43)
at dev.emad.selenium.book.Main.main(Main.kt)
Caused by: org.openqa.selenium.WebDriverException: Driver server process died prematurely.
Build info: version: '4.1.3', revision: '7b1ebf28ef'
System info: host: 'FriendlyELEC', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'aarch64', os.version: '5.10.60', java.version: '11.0.14.1'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:226)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:98)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:567)
... 8 more
I have tried xvfb but it didn't help, And here is he code that I'm using:
WebDriverManager.chromedriver().setup()
val chromeOptions = ChromeOptions().apply {
setHeadless(true)
addArguments(
"--disable-infobars",
"--disable-extensions",
"--disable-application-cache",
"--disable-gpu",
"--disable-dev-shm-usage",
"--dns-prefetch-disable",
"--ignore-ssl-errors",
"--ignore-certificate-errors",
"--no-sandbox",
"--window-size=1920,1080",
"--remote-debugging-port=9222"
)
}
chromeOptions.setBinary("/usr/bin/chromium-browser")
driver = ChromeDriver(chromeOptions)
driver.get("https://bing.com")

chrome-driver 83 compatibility with Ubuntu

I'm running Ubuntu 18.04.1 LTS and used stable versions of Google Chrome v81 and compatible chrome-driver v81 for a long time successfully.
After reinstalling google-chrome-stable up to 83.0.4103.61 and updating chrome-driver up to 83.0.4103.39. According to the official page they are fully compatible.
But after these updates I'm getting error unable to connect to renderer.
My capabilities remains the same:
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [
'--headless',
'--disable-gpu',
'--no-sandbox',
'--remote-debugging-port=9222',
'--ignore-certificate-errors',
'--allow-insecure-localhost'
]
}
}
And full error message is the following:
[11:07:05] E/launcher - session not created
from disconnected: unable to connect to renderer
(Session info: headless chrome=83.0.4103.61)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '******', ip: '******', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-38-generic', java.version: '10.0.2'
Driver info: driver.version: unknown
remote stacktrace: #0 0x5633488fb579 <unknown>
My webdriver-manager status:
[11:24:59] I/status - selenium standalone version available: 3.141.59 [last]
[11:24:59] I/status - chromedriver version available: 83.0.4103.39 [last]
[11:24:59] I/status - geckodriver version available: v0.26.0 [last]
[11:24:59] I/status - android-sdk is not present
[11:24:59] I/status - appium is not present
Does anybody faced the same issue and knowing how to solve it or rollback to v81 correctly? Any suggestions will be appreciated.
P.S. 1) the same config works well locally on the latest MacOS 2) I didn't succeed to launch chromium-browser v81 with driver v81, probably did the rollback in a wrong way.
The issue is resolved. The problem was that I was using argument --remote-debugging-port=9222. But someday google-chrome process got stuck deadly and occupied the port. So, when the chromedriver starts the google-chrome it can't get access to busy port for debugging purposes and simply exits with no errors. That's why the chromedriver can't get access to google-chrome and sends unable to connect to renderer error.
The solution is:
kill frozen processes that occupy ports
use debugging-port when you really need it
using direct connection to the chromedriver reduces "layers" so the overall stability was improved

Chromedriver couldn't open chrome browser on AWS EC2

I'm trying to run simple Java code to setup EC2 machine on AWS and its pure purpose is to run selenium.
The same code on my local (MAC) works fine, just by changing the chrome path
I could start chromedriver and google-chrome independently with out issues.
chromedriver version - 71.0.3578.80
Google Chrome 71.0.3578.98
Here it is the Java Code
import java.io.IOException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class TecAdminSeleniumTest {
public static void main(String[] args) throws IOException, InterruptedException {
System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--no-sandbox");
WebDriver driver = new ChromeDriver(chromeOptions);
driver.get("https://google.com");
Thread.sleep(1000);
if (driver.getPageSource().contains("I'm Feeling Lucky")) {
System.out.println("Pass");
} else {
System.out.println("Fail");
}
driver.quit();
}
}
Error observed:
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'
System info: host: 'XXXXXXX', ip: 'XXXXXX', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.77-70.59.amzn1.x86_64', java.version: '1.8.0_25'
I keep getting the following exception :
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.chrome.ChromeDriver.startSession(ChromeDriver.java:182)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:115)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:161)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:150)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:139)
This error message...
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15' System info: host: 'XXXXXXX', ip: 'XXXXXX', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.77-70.59.amzn1.x86_64', java.version: '1.8.0_25'
...implies that there are some incompatibility between the version of the binaries you are using as follows:
Your Selenium Client version is 2.39.0 of 2013-12-16 16:11:15 which is more than 5 years older.
Your JDK version is 1.8.0_25 which is pretty ancient.
So there is a clear mismatch between the JDK v8u25 and Selenium Client v2.39
Solution
Upgrade JDK to recent levels JDK 8u191.
Upgrade Selenium to current levels Version 3.141.59.
Upgrade ChromeDriver to current ChromeDriver v2.45 level.
Keep Chrome version between Chrome v70-72 levels. (as per ChromeDriver v2.45 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Free Up and Release the Unused/Cached Memory in Ubuntu/Linux Mint before and after the execution of your Test Suite.
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test.

"Unable to connect to renderer" after upgrade to protractor 4.0.9. Tests won't run. Any ideas as to why?

I had been happily using protractor 3.3.0 with chromedriver 2.21 until Chrome version 54 broke it. I updated to protractor 4.0.9 with chromedriver 2.24 as recommended by the interwebs and now I can't get protractor to run my tests. It looks like it'll start up, flashing a browser window and then throwing this...
Stack trace:
[09:51:27] I/direct - Using ChromeDriver directly...
[09:51:27] I/launcher - Running 1 instances of WebDriver
[09:51:28] E/launcher - session not created exception
from disconnected: unable to connect to renderer
(Session info: chrome=54.0.2840.71)
(Driver info: chromedriver=2.24.417412 (ac882d3ce7c0d99292439bf3405780058fcca0a6),platform=Mac OS X 10.12.0 x86_64)
[09:51:28] E/launcher - SessionNotCreatedError: session not created exception
from disconnected: unable to connect to renderer
(Session info: chrome=54.0.2840.71)
(Driver info: chromedriver=2.24.417412 (ac882d3ce7c0d99292439bf3405780058fcca0a6),platform=Mac OS X 10.12.0 x86_64)
at WebDriverError (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:10)
at SessionNotCreatedError (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:308:10)
at Object.checkLegacyResponse (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:639:15)
at parseHttpResponse (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:538:13)
at /Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:472:11
at ManagedPromise.invokeCallback_ (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14)
at TaskQueue.execute_ (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)
at TaskQueue.executeNext_ (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)
at /Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2820:25
at /Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7
From: Task: WebDriver.createSession()
at Function.createSession (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
at Driver (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/selenium-webdriver/chrome.js:778:38)
at Direct.getNewDriver (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/built/driverProviders/direct.js:68:26)
at Runner.createBrowser (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/built/runner.js:198:43)
at /Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/built/runner.js:277:30
at _fulfilled (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/q/q.js:796:13)
at /Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/q/q.js:556:49
at runSingle (/Users/gregorybuchanan/.nvm/versions/node/v4.2.6/lib/node_modules/protractor/node_modules/q/q.js:137:13)
[09:51:28] E/launcher - Process exited with error code 199
I can't find anything referencing this problem...Any ideas?
macOS Sierra
Chrome 54
Protractor 4.0.9
Selenium 2.53.1
Node 4.2.6
My conf.js file:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
framework: 'jasmine2',
suites: {
views: './*_view_spec.js',
forms: './*_form_spec.js',
active: ['./registration_spec.js', './onboarding_spec.js'],
all: './*_spec.js',
current: './registration_spec.js'
},
specs: ['./*_spec.js'],
jasmineNodeOpts: {
showColors: false
},
directConnect: true,
capabilities: {
chromeOptions: {
args: ['--no-sandbox', '--user-data-dir=ProtractorTestProfile','--prompt-for-external-extensions=false', '--load-extension=extension-debug/development/chrome']
},
browserName: 'chrome'
},
params: {
environment: {
api: 'dev',
baseUrl: 'http://webapp-dev.xxxxxxx.com/#/'
}
},
onPrepare: function() {
browser.driver.manage().window().setSize(1280, 1024);
var disableNgAnimate = function() {
angular.module('disableNgAnimate', []).run(['$animate', function($animate) {
$animate.enabled(false);
}]);
};
browser.addMockModule('disableNgAnimate', disableNgAnimate);
browser.getCapabilities().then(function(caps) {
browser.params.browser = caps.get('browserName');
});
}
};
I had the same problem and it turns out that the problem was with my /etc/hosts file. I had
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain hostname
::1 localhost.localdomain hostname
when it was supposed to be
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
so the Selenium server thought that you were connecting to it from a remote address or something and blocked the connection.
That's also probably why a fresh reinstall of macOS fixed the problem for you.
Hopefully this helps somebody looking at this in the future!
How have you updated the chrome driver? By using:
webdriver-manager update --versions.chrome 2.24 ?
I had this exactly same issue and I resolved by downloading the chrome driver version from http://chromedriver.storage.googleapis.com/index.html?path=2.24/ extracting the file into my selenium folder (/usr/local/lib/node_modules/webdriver-manager/selenium/) and removing the old one.
I believe there is some error with updating chrome driver using command lines, see: https://github.com/angular/webdriver-manager/issues/102
I couldn't figure this out and couldn't burn anymore time trying. A complete/fresh install of macOS did the trick.
I had the same issue, and reset the hosts, then clear the socket by using
chrome://net-internals/#sockets
That would do the trick.
It's not a selenium or a webdriver problem, just some thing to do with the chrome socket/host buffering.
I came here with the same issue. One day I was running tests just fine, the other day I turned on the IDE, ran the tests again, and it spat out this error. I stumbled upon a solution when I killed Chrome, ChromeDriver, and Eclipse processes, copied a version of Chrome driver that I randomly picked form the repo, then restarted them all and it started working again for some reason. I unfortunately have no idea about the root of this problem.
I am seeing the same issue on Chrome: Version 62.0.3202.75 (Official Build) (64-bit) and ChromeDriver Version: 2.32. I just followed these steps and I am able to run my tests successfully
If you are using browser.manage().window().maximize(); or anything with browser.manage() in your page objects or tests, try to remove them and use the chrome capabilities in protractor.conf.js.
Here is an Example:
capabilities: {
browserName: 'chrome',
chromeOptions: {
// binary: 'PATH/To/your/binary',
args: [
'--disable-infobars', "--disable-gpu", "--start-maximized", '--disable-extensions'
],
prefs: {
// disable chrome's annoying password manager
'profile.password_manager_enabled': false,
'credentials_enable_service': false,
'password_manager_enabled': false
}
}
}

Resources