Protractor won't run chrome - google-chrome

Protractor was running fine but suddenley won't run chrome anymore. This is mye current configuration:
exports.config = {
baseUrl: 'http://localhost:1384/#/',
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['./tests/e2e/*.js'],
multiCapabilities: [{
//'browserName': 'firefox',
'browserName': 'chrome',
},
],
jasmineNodeOpts: {
showColors: true
}
}
I am running latest of all the related dependencies:
protractor : "protractor": "^5.2.0",
chromedriver: 2.33.506092
webdriver: selenium standalone version available: 3.7.1 [last]
when I run webdriver-manager start eveything runs fine, and then running protractor conf.js gives the following output in the window running the selenium server:
Starting ChromeDriver 2.33.506092 Only local connections are allowed.
The terminal windows running the protractor config, gives the following errros:
E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally
I have already tried reinstalling protractor and updating the chromedriver. Running the tests work fine in firefox with the exact same configurations.
I am also running tests with karma, and karma runs fine in a chrome browser window.

Add directConnect: true to your config file. It might help you.

this would be your conf file
exports.config = {
directConnect: true,
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome',
},
// Framework to use. Jasmine is recommended.
framework: 'jasmine',
baseUrl: "YOUR URL",
// Spec patterns are relative to the current working directory when
// protractor is called.
specs: ['../Tests/test.js'],
// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
},
};
you don't need to give below dependencies because chrome get launched from conf file only
chromedriver: 2.33.506092
webdriver: selenium standalone version available: 3.7.1 [last]

Ran into similar issue. Try updating chrome which should fetch the new compatible chrome driver.

Related

ChromeDriver mismatch with Chrome version - unable to get latest version with node module "#wdio/selenium-standalone-service"

In my codeceptjs setup, I updated #wdio/selenium-standalone-service to latest version 6.9.0
This seem to install chromedriver version version: '85.0.4183.87'
Now that chrome browser version upgraded to 87.0.4280.66, tests that worked fine earlier are now failing with:
Can't connect to WebDriver.
Error: Failed to create session.
session not created: This version of ChromeDriver only supports Chrome version 85
Any suggestion on how this issue can be resolved. Since I am using "#wdio/selenium-standalone-service", did not separately install chromedriver. Hence have this version issue with "#wdio/selenium-standalone-service"
we faced the exact same problem! I managed to get this working by using this version of wdio selenium standalone(5.16.10). I have no idea why it works with this older version though.
“devDependencies”: {
“#wdio/selenium-standalone-service”: “^5.16.10”,
You can specify the latest chromedriver version you want it to use by specifying it in the plugins section.
plugins: {
screenshotOnFail: {enabled: true},
wdio: {enabled: true, services: [‘selenium-standalone’],seleniumArgs: {
drivers: {
chrome: {
version: ‘87.0.4280.20’, // Chromedriver version
arch: process.arch,
},
firefox: {
version: ‘0.26.0’, // Geckodriver version
arch: process.arch,
},
},
},
seleniumInstallArgs: {
baseURL: ‘https://selenium-release.storage.googleapis.com’,
drivers: {
chrome: {
version: ‘87.0.4280.20’,
arch: process.arch,
baseURL: ‘https://chromedriver.storage.googleapis.com’,
},
firefox: {
version: ‘0.26.0’,
arch: process.arch,
baseURL: ‘https://github.com/mozilla/geckodriver/releases/download’,
},
},
}},
allure: {enabled: true},
},
Its a driver mismatch I'm using protractor helper in your case it will webdriver
..../node_modules/protractor/node_modules/webdriver-manager/selenium
so, the solution or you can say its a hack
download the latest chrome driver.
navigate to the respected path mentioned above and copy the chrome driver file name(not the .zip one)
unzip the latest downloaded file here >> delete the existing file and rename the file name which you have copied in the step 2
Now try to run you code

Behat selenium Chromedriver CreatePlatformSocket error

I am trying to run test with selenium and chromedriver.
i have a centos 6.7 installed chrome and used chrome lib from chromedriver ( found script here https://chrome.richardlloyd.org.uk/)
front:
extensions:
Behat\MinkExtension:
base_url: 'http://urlfront/'
browser_name: chrome
sessions:
default:
selenium2:
wd_host: 'http://127.0.0.1:4444/wd/hub'
capabilities:
browser: chrome
suites:
front:
filters:
tags: front
admin:
extensions:
Behat\MinkExtension:
base_url: 'http://url/'
browser_name: chrome
sessions:
default:
selenium2:
wd_host: 'http://localhost:4444/wd/hub'
capabilities:
browser: chrome
suites:
admin:
filters:
tags: admin
this is my behat .yml
im starting selenium with this command :
java -jar selenium-server-standalone.jar -trustAllSSLCertificates -Djava.net.preferIPv4Stack=true -Dwebdriver.chrome.driver=chromedriver -Dwebdriver.chrome.bin=/opt/google/chrome/google-chrome
when I run behat, i got an error on selenium
[27,690][SEVERE]: CreatePlatformSocket() returned an error, errno=97: Famille d'adresses non supportée par le protocole ( address family not supported)
this error loop for a while and at the end it show me this
12:01:01.718 WARN - Exception: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.23.409687 (c46e862757edc04c06b1bd88724d15a5807b84d1),platform=Linux 2.6.32-573.el6.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
I don't know where to search, is that an error from chrome not starting or protocol not supported or both ?
hope someone can help me on this I tried a lot of things reinstalled chrome with the script but maybe it was not cleaned and I still have a wrong version ?

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.

jasmine-reporters modifySuiteName not work?

I'm using protractor with jasmine-reporters 2.0.7
I tried to use the modifySuiteName option to modify suite names.
This is what in my conf.js:
multiCapabilities: [{
browserName: 'firefox'
}, {
browserName: 'chrome'
}],
onPrepare: function() {
var jasmineReporters = require('jasmine-reporters');
return browser.getProcessedConfig().then(function(config) {
var browserName = config.capabilities.browserName;
jasmine.getEnv().addReporter(
new jasmineReporters.JUnitXmlReporter({
savePath: 'c://scripts',
filePrefix: browserName,
consolidateAll: true,
modifySuiteName: function(generatedSuiteName, suite) {
return browserName+ '.' + generatedSuiteName;}
}));
});
},
I suppose to see
testsuite name="chrome.Demo App"
in chrome.xml
and
testsuite name="firefox.Demo App"
in firefox.xml
But I can only see
testsuite name="Demo App"
in both files.
Is there anything wrong in my code?
Okay now I figure out that my issue is caused by a stupid mistake.
I'm using windows 8 and running cmd under the folder c:\scripts.
I'm so new to nodejs and npm that during the set-up process I used npm install --save-dev jasmine-reporters#^2.0.0 and few days later I used npm install -g jasmine-reporters#latest
So there are 2 jasmine-reporters in my system, one in C:\Users\xxx\AppData\Roaming\npm\node_modules\jasmine-reporters
and another in C:\scripts\node_modules\jasmine-reporters,
with version 2.0.7 and 2.0.0 in package.json, respectively.
I just update my jasmine-reporters in C:\scripts\node_modules to 2.0.7 and the script finally works!
Thanks for your time, I really appreciate it.
As far as i see, there is no fault in your code. If your code is generating chrome and firefox xml's then everything with your configuration should be fine. Your code is working perfectly fine in my protractor. I am using Jasmine 2.3.1 with protractor 2.1.0. Try updating your protractor and jasmine framework to the latest version and then run your test suite. To update your jasmine run the below command -
npm update -g jasmine
Also if you have not added the framework tag after multiCapabilities tag in your conf.js file then you should be doing so as shown below -
framework: 'jasmine2',
Hope this solves your issue.

Running "karma:unit" (karma) task WARN [reporter]: Can not load "html", it is not registered! Perhaps you are missing some plugin?

I'm getting following warn when I ran grunt test and doesn't give me the expected result, which is writing the progress of unit tests.
error:-
Running "karma:unit" (karma) task
WARN [reporter]: Can not load "html", it is not registered!
Perhaps you are missing some plugin?
INFO [karma]: Karma v0.12.15 server started at http://localhost:8080/
INFO [launcher]: Starting browser Chrome
WARN [watcher]: Pattern "F:/AngularExamples/TestingAngular/test/mock/**/*.js" do
es not match any file.
INFO [Chrome 34.0.1847 (Windows 7)]: Connected on socket Mxn9RZeJcSW1gjL_e3d2 wi
th id 36948068
Chrome 34.0.1847 (Windows 7): Executed 1 of 1 SUCCESS (0.04 secs / 0.037 secs)
Done, without errors.
html report plugin integration in karma.config.js :-
reporters: ['progress', 'html'],
// the default configuration
htmlReporter: {
outputDir: 'karma_html',
templatePath: __dirname+'/jasmine_template.html'
},
can someone point me the cause?
First, make sure it has been installed - there should be a karma-html-reporter directory in node_modules in the directory from which you are running the tests. If not run:
npm install karma-html-reporter
Then confirm you have 'karma-html-reporter' in plugins in the conf, i.e:
plugins: [
'karma-teamcity-reporter',
'karma-jasmine',
'karma-coverage',
'karma-chrome-launcher',
'karma-phantomjs-launcher',
'karma-html-reporter'
]