Not able to maximize Chrome Window in headless mode - google-chrome

I recently upgraded my chrome version to 60 and chromedriver to version 2.31. Post that I have started getting the following exception when I try to do a maximize of the browser window.
driver.driver.manage().window().maximize()
org.openqa.selenium.WebDriverException: unknown error: failed to
change window state to maximized, current state is normal (Session
info: chrome=60.0.3112.78) (Driver info: chromedriver=2.31.488763
(092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Linux
4.2.0-27-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 108 milliseconds
Build info: version: '2.53.1', revision:
'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30
19:26:09' System info: host: 'bb-blr-prod-stage-stg1-01', ip:
'10.3.211.2', os.name: 'Linux', os.arch: 'amd64', os.version:
'4.2.0-27-generic', java.version: '1.7.0_80' Session ID:
c7de7149dd490cc7760d2f4fc49f0325 Driver info:
org.openqa.selenium.chrome.ChromeDriver Capabilities [{platform=LINUX,
acceptSslCerts=true, javascriptEnabled=true, browserName=chrome,
chrome={userDataDir=/tmp/.org.chromium.Chromium.WABPhO,
chromedriverVersion=2.31.488763
(092de99f48a300323ecf8c2a4e2e7cab51de5ba8)},
networkConnectionEnabled=false, unexpectedAlertBehaviour=,
rotatable=false, setWindowRect=true, locationContextEnabled=true,
mobileEmulationEnabled=false, pageLoadStrategy=normal,
version=60.0.3112.78, takesHeapSnapshot=true,
cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true,
browserConnectionEnabled=false, webStorageEnabled=true,
nativeEvents=true, hasTouchScreen=false,
applicationCacheEnabled=false, takesScreenshot=true}]
I run my tests in headless mode using ChromeDriver on Geb.
Chrome version - 60.0.3112.78
chromedriver version - 2.31.488763
OS - Ubuntu 14.04.4 LTS
Selenium version - 2.53.1
WebDriver Language Bindings
Geb - 0.13.1

Since you're running tests in a headless mode, there is no active browser window available. As such your
driver.driver.manage().window().maximize()
would always fail in such situations because the driver doesn't know which window to maximize since there aren't any available.
You can either follow what #DebanjanB has mentioned or you can start the headless browser with a specific screen size like 1440x900 etc, doing something like this
driver.manage().window().setSize(new Dimension(1440, 900));
[Edit] In most cases now that I've seen that the maximize() method works in headless too - however I've not tested this on a CI system.

Add below ChromeOption in your code :
options.addArguments("--window-size=1325x744");
Also refer this blog for more

This is an open bug (follow here) : https://bugs.chromium.org/p/chromedriver/issues/detail?id=1901

There seems to be a minor discrepancy in the line of code:
driver.driver.manage().window().maximize()
You need to replace this line of code with:
driver.manage().window().maximize()
In case this solution doesn't address your issue, to use Google Chrome in headless you can use either of the following solutions:
Using start-maximized
It is recommended to maximize the Google Chrome browser through ChromeOptions class as follows:
Code Block:
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
options.addArguments("--headless");
options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
options.setExperimentalOption("useAutomationExtension", false);
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.google.com/");
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File(".\\Screenshots\\using-start-maximized.png"));
driver.quit();
Browser Snapshot:
Using --window-size=1400,600
As an alternative you can also add the argument for the expected window size as follows:
Code Block:
ChromeOptions options = new ChromeOptions();
options.addArguments("--window-size=1400,600");
options.addArguments("--headless");
options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
options.setExperimentalOption("useAutomationExtension", false);
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.google.com/");
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File(".\\Screenshots\\using-window-size.png"));
driver.quit();
Browser Snapshot:
Using setSize(new Dimension(1440, 900))
Code Block:
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
options.setExperimentalOption("useAutomationExtension", false);
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.google.com/");
driver.manage().window().setSize(new Dimension(1440, 900));
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File(".\\Screenshots\\using-setSize.png"));
driver.quit();
Browser Snapshot:
tl; dr
You can find Selenium python client based discussion on maximizing window in Selenium Firefox headless returns different results

I'm using chromedriver 2.30 & chrome browser v60 through protractor. I run the tests headless too albeit I don't do it via chromeoptions. Rather I run tests headless using xvfb-run on a unix distribution. I'm encountering this issue also albeit it fails randomly for me. See stack below
[chrome #11] [31mWebDriverError: unknown error: failed to change window state to maximized, current state is normal
[chrome #11] (Session info: chrome=60.0.3112.78)
[chrome #11] (Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 3.10.0-514.26.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
[chrome #11] Command duration or timeout: 122 milliseconds
[chrome #11] Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
[chrome #11] System info: host: 's1wfadvcilvm08', ip: '172.16.184.183', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-514.26.2.el7.x86_64', java.version: '1.8.0_141'
[chrome #11] Driver info: org.openqa.selenium.chrome.ChromeDriver
[chrome #11] Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57), userDataDir=/tmp/.org.chromium.Chromium.BNsN1w}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=60.0.3112.78, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
My code at the beginning of each test does the following
browser.manage().window().maximize();
changing to
driver.driver.manage().window().maximize();
driver.manage().window().maximize();
doesn't work for me either unfortunately. Shouldn't browser.manage().window().maximize() be still working as I'm running headless using xvfb-run rather than doing headless via chrome options?

This bug was initially fixed in ChromeDriver 2.42, and was actual for macOS until 2.44 (check changelogs: http://chromedriver.chromium.org/downloads).
So there is a solution for everyone who faces this issue: update your driver version

This is known issue on Ubuntu 20.04 LTS for headless Google Chrome. I just used Java's awt pakage to get maximum resolution of whatevevr screen i.e. xvbf for Ubuntu LTS and current screen for Windows 10 and set it in arggument of ChromeOption to configure Webdriver
java.awt.Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
chromeOptions.addArguments("--window-size=" + (int) screenDimension.getWidth() + "," + (int) screenDimension.getHeight());

Related

Chromedriver 2.36 with chrome v65 giving exception

I have recently updated ChromeDriver to 2.36 after chrome was auto updated to v65.
But on running test now i am getting below exceptions
Starting ChromeDriver 2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91) on port 10482
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: failed to write automation extension zip
(Driver info: chromedriver=2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 218 milliseconds
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: '172.16.27.222', ip: '172.16.123.114', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_77'
Driver info: driver.version: ChromeDriver
Have tried both chromeOptions & DesiredCapabilties
ChromeOptions o = new ChromeOptions();
o.addArguments("disable-extensions");
o.addArguments("--start-maximized");
ChromeDriver chromeDriver = new ChromeDriver(o);
return chromeDriver;
Also tried below method :
ChromeDriver chromeDriver = new ChromeDriver(capabilities);
chromeDriver.manage().window().maximize();
The error says it all :
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: failed to write automation extension zip
(Driver info: chromedriver=2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 218 milliseconds
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: '172.16.27.222', ip: '172.16.123.114', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_77'
Driver info: driver.version: ChromeDriver
It is clear from your error stack trace that the driver.version is not getting recognized.
Your main issue is the version compatibility between the binaries you are using as follows :
You are using chromedriver=2.36
You are using chrome=65.0 (as per your question)
You are using Selenium Client v3.11.0
Your JDK version is 1.8.0_77 which is pretty ancient.
So there is a clear mismatch between the JDK v8u77 , Selenium Client v3.11.0 , ChromeDriver version (v2.36) and the Chrome Browser version (v65.0)
Solution
Upgrade JDK to recent levels JDK 8u162.
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 Chrome version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Chrome.
Execute your #Test.
Additional Considerations
If you intend to use ChromeDriver and Chrome Browser, while initializing the WebDriver instance instead of using the ChromeDriver implementation use the WebDriver interface as follows :
WebDriver chromeDriver = new ChromeDriver(o);
If you intend to maximize the browser window, instead of using chromeDriver.manage().window().maximize(); use the ChromeOptions instance as follows :
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
Here are the arguments I use:
ArrayList<String> args = new ArrayList<String>();
args.add("enable-automation");
args.add("test-type=browser");
args.add("disable-plugins");
args.add("disable-infobars");
args.add("disable-extensions");
options.put("args", args);
I think you need to at least add the "enable-automation" argument.

Chome 61, ChromeDriver 2.32 Click on element for mobile device emulators throws WebDriverException: unknown error: Element is not clickable at point

I have tests that were perfectly working in Chrome 60 and ChromeDriver 2.31, but after Chrome updated to 61 version I had to update ChromeDriver to 2.32. And now I am getting sporadic org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (X, Y) - in all tests that are run for mobile device emulators such as "iPhone 6 Plus" browser mode,
for example.
As a workaround I would probably use scroll to element before the click, but it's just a quick fix and it's better to know where this issue comes from. Is it the issue of the current latest Chrome and driver releases? Is it going to be fixed soon?
Issue is reproduced on both local and remote webdriver.
Stacktrace:
org.openqa.selenium.WebDriverException: unknown error: Element is not
clickable at point (182, 3724) (Session info: chrome=61.0.3163.91)
(Driver info: chromedriver=2.32.498550
(9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),platform=Windows NT
10.0.15063 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 115 milliseconds Build info:
version: '3.4.0', revision: 'unknown', time: 'unknown' System info:
host: 'xxx', ip: '10.100.8.33', os.name: 'Windows 10', os.arch:
'amd64', os.version: '10.0', java.version: '1.8.0_131' Driver info:
org.openqa.selenium.chrome.ChromeDriver Capabilities
[{applicationCacheEnabled=false, rotatable=false,
mobileEmulationEnabled=true, networkConnectionEnabled=false,
chrome={chromedriverVersion=2.32.498550
(9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),
userDataDir=C:\Users\xxx\AppData\Local\Temp\scoped_dir5912_31757},
takesHeapSnapshot=true, pageLoadStrategy=normal,
databaseEnabled=false, handlesAlerts=true, hasTouchScreen=true,
version=61.0.3163.91, platform=XP, browserConnectionEnabled=false,
nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true,
webStorageEnabled=true, browserName=chrome, takesScreenshot=true,
javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true,
unexpectedAlertBehaviour=dismiss}] Session ID:
2ead932fef8d0d923286ac41c8fffe50 Command duration or timeout: 257
milliseconds
I guess it relates to https://bugs.chromium.org/p/chromedriver/issues/detail?id=1852
Chrome driver Developers are aware that the fix is not working properly in mobile device emulate mode. A fix for that is coming in ChromeDriver 2.33.
you need to downgrade your chrome version to 59.0 (32 bit), as there is some with issue with the new chrome update.
or
you need to scroll to element first and then try to click
I am not absolutely sure but your issue sounds very much like mine one. My tests appeared to be not able to scroll to the element using the built-in move_to_element() Selenium method after my browser was updated.
Here is my workaround written in python
def scroll_to_element(element):
self.driver.execute_script("window.scrollTo(0, %d);" %
element.location['y'])
As a temporary solution – try to scroll to the element an then try to click it. Hope this helps you for now.
There are alternate solution for this:
First maximize the window:
driver.manage().window().maximize();
Second, You can use the Action class to moveToElementmethod and access it
WebElement element = driver.findElement(By("element"));
Actions action = new Actions(driver);
action.moveToElement(element).click().perform();
try to click using javascript its works for me.
WebElement element = driver.findElement(By.id("gbqfd"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
I have the same problem (movetoelement does nothing in mode movilemulation with chromedriver2.32 and Chrome61+) and the only solution for me was back to Chrome60. You can obtains older versions of chrome in
https://www.slimjet.com/chrome/google-chrome-old-version.php
When chromedriver2.33 arrives then i will test again against Chrome61+

How can I set the browser window size when using `google-chrome --headless`?

I tried setting the browser size on Chrome --headless by using Selenium WebDriver commands.
I get this WebDriver error:
- Failed: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: headless chrome=58.0.3029.81)
(Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.4.0-72-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.07 seconds
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: '826f6a766112', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-72-generic', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5), userDataDir=/tmp/.org.chromium.Chromium.cuymDL}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=58.0.3029.81, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: 9569e5ebd8f7540ce510b20647443baf
I found it. Simply pass the --window-size command line argument to Google Chrome, for example --window-size=1920,1080.
In a Protractor configuration this would look like this:
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['headless', 'window-size=1920,1080']
}
}
The cool thing is that the windows size is not limited to the current display. It is truly headless, meaning it can be as large as needed for the tests.
Java code:
options.addArguments("window-size=1920,1080");
I expand a bit more on this in Headless protractor not sharding tests.
Use the built-in Selenium function:
aDriver.manage().window().setSize(new Dimension(width, height));
It works like a champ. I've used it for Firefox, Chrome (even headless), and Edge.
I had a problem with screen resolution when running on Jenkins (which forces headless mode). The solution was very simple: set headless mode to true explicitly. For some reason, not doing this explicitly caused my screen to "shrink" causing all kinds of "element intercept click" issues. Because I was taking screenshots during failures, I noticed the resolution (size) was not right. Once I did this, the problem went away; confirmed by screenshots taken during failures.
To avoid conflicts with local configurations, I moved the value of this flag into a configuration file that was then added to our .gitignore file to prevent accidental overwrites.
If you are like me, where none of these commonly solutions worked out, make sure you explicitly set this value:
ChromeOptions options = new ChromeOptions();
...
String headlessMode = readProperty("headless_mode"); // Get value from some prop file (my own implementation)
options.setHeadless(Boolean.valueOf(headlessMode));
...
driver = new ChromeDriver(options);
If you don't want (or need) this separation, simply set the value to true in the setHeadless method call.
Mr. Leo's answer is working like charm. and i've tested this with 6000x6000 window size.
Same in c#
var options = new ChromeOptions();
options.AddArgument("no-sandbox");
options.AddArgument("headless");
options.addArguments("window-size=1920,1080");
IWebDriver _driver= new ChromeDriver($#"path to chrome web driver folder", options, TimeSpan.FromSeconds(130));
I had the question in Python, so here's the Python solution:
options = Options()
options.headless = True
options.add_argument("window-size=1920,1080");
driver = webdriver.Chrome(options=options)

Selenium "chrome not reachable" error and can't access browser web elements after test kills existing browser and launches new

Selenium "chrome not reachable" error and can't access browser web elements after test kills existing browser and launches new
I'm using latest java, chrome driver and selenium 3.0 latest jar for automating web application, everything works very fine except when test fails; it kills browser according to my requirement and new test uses new browser but chrome shows unreachable.
Now is there any binding to previous session? How subsequent browser launch can't identify web objects and it works fine for first first launch only? Does anyone have solution for this or can anyone try in your framework after killing existing browser and launching new in between of the test using latest GA or beta web driver version?
Steps:
- Write below code and launch chrome using web driver
- Navigate to your web application
- Login to it (WORKS FINE)
- Assume test fails, so it kills existing chrome browser
- Again hits below code and opens new browser
- Navigate to application again
- Login to it (DOESN'T WORK - because it can't identify web objects for newly launched browser due to "chrome not reachable" error).
Code:
ChromeOptions options = new ChromeOptions();
options.addArguments("chrome.switches","--disable-extensions");
options.addArguments("--start-maximized");
System.setProperty("webdriver.chrome.driver", chromedriverPath);
webDriver = new ChromeDriver(options);
webDriver.navigate().to(myURL);
WebDriver.findElement(By.cssSelector(input[class=LoginButton]))
Error:
Build info: version: 'unknown', revision: '2aa21c1', time: '2016-08-02 14:59:43 -0700'
System info: host: 'abc', ip: '12.116.61.2', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_102'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129), userDataDir=C:\Users\abc\AppData\Local\Temp\scoped_dir7360_5203}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=52.0.2743.116, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 4d9e503ddb4ae1506b1592a0426bb7ff
*** Element info: {Using=css selector, value=input[class=LoginButton]}
129615 [main] INFO com.util.SleepUtil - Sleep: 1000 milliseconds ... (0/1000)
130615 [main] INFO com.util.SleepMetrics - Entry: com.selenium.functions.Login.NavigateTo() - Sleep: 1000/2000
130615 [main] INFO com.framework - ...WebDriver...findElement()
130615 [main] INFO com.framework - ...WebDriver...elementPresent()
130615 [main] INFO com.framework - ...WebDriver...getElementOrNull()
130615 [main] INFO com.framework - ...WebDriver...getElementByCss()
130615 [main] INFO com.framework - ...WebDriver...configureCssLocator()
132629 [main] INFO com.framework - ...WebDriver.findElement(By.cssSelector(input[class=LoginButton]))
135651 [main] INFO com.framework - ...getElementByCss()...org.openqa.selenium.WebDriverException: chrome not reachable

WebDriverError: unknown error: Chrome failed to start: exited abnormally

What I'm trying to achieve
Successfully run my protractor tests on headless chrome on Ubuntu 14 non gui.
Set up
Using multiple reference pages I have managed to successfully install: Xvfb Chrome latest browser Protractor 3.3.0 Java 7 (also tried with Java 8) and also set the LOCAL_HOME. Also, managed to start the Xvfb using this reference.
Protractor conf
exports.config = {
baseUrl: 'http://<qa environment>',
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
jasmineNodeOpts: {
showColors:true,
defaultTimeoutInterval: 2500000
},
capabilities: {
'browserName': 'chrome'
},
specs: ['administration/*-spec.js'], //'signinandout/*-spec.js', 'homepage/*-spec.js',
onPrepare: function(){
//browser.driver.manage().window().setSize(1280, 1080);
}
}
Exception stack trace:
/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/error.js:26
constructor(opt_error) {
^ WebDriverError: unknown error: Chrome failed to start: exited abnormally (Driver info:
chromedriver=2.21.371461
(633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux
3.13.0-87-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.16 seconds
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11
19:06:42' System info: host: 'vagrant-ubuntu-trusty-64', ip:
'10.0.2.15', os.name: 'Linux', os.arch: 'amd64', os.version:
'3.13.0-87-generic', java.version: '1.7.0_101' Driver info:
org.openqa.selenium.chrome.ChromeDriver
at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/error.js:26:26)
at Object.checkLegacyResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/error.js:580:13)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:64:13
at Promise.invokeCallback_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1329:14)
at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2790:14)
at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2773:21)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2652:27
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:103:7) From: Task: WebDriver.createSession()
at acquireSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:62:22)
at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:295:12)
at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:458:24)
at Hosted.DriverProvider.getNewDriver (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:37:33)
at Runner.createBrowser (/usr/local/lib/node_modules/protractor/built/runner.js:182:43)
at /usr/local/lib/node_modules/protractor/built/runner.js:255:30
at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:796:13)
at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:556:49
[01:09:14] E/launcher - Process exited with error code 1
Check your Google chrome Version and its compatibility with the chrome driver.
You can check that from the Chromedriver Site and download the compatible version.
It worked for me.
probably your window screen size is not matching try giving maximize in onPrepare:
onPrepare: function(){
browser.driver.manage().window().maximize();
}
Open your project and Please update your npm modules by the following command.
project_root:\> npm update
Now update your selenium driver to the latest version using the following command
project_root:\> webdriver-manager update
Run your tests again.
Error due to Xvfb display is not specified here. Here , Selenium scripts are running using headless browser testing concept which is without GUI.
Hope u have used chromedriver, chrome binaries and XVfb. here chromedriver is initializing chrome binaries but chrome binary not able to sits on the monitor with XVfb .Thats y its throwing error as " Chrome failed to start:exit abnormally"
please follow the below steps before executing ur script.Example:(Execute this cmd in ur Unix server (ex.putty))
usr/bin/Xvfb :2 -ac -screen 0 1280x1024x24 &
export DISPLAY=:2
It will work definitely.