I've seen this question before but nothing in the answers solved my problems. I am trying to do the protractor tutorial and here is the conf.js file:
// conf.js
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']
}
Here is the spec.js file:
// spec.js
describe('Protractor Demo App', function() {
it('should have a title', function() {
browser.get('http://juliemr.github.io/protractor-demo/');
expect(browser.getTitle()).toEqual('Super Calculator');
});
});
I am also getting ERROR100 on running another project, but for simplicity, I'm going to focus on this one project. Here is the error I'm getting:
E/configParser - Error code: 105
E/configParser - Error message: failed loading configuration file conf.js
E/configParser - C:\Workspace\ProtractorCalc\conf.js:6
I know this has to be something with my webdriver/selenium, but I don't know enough to debug it properly. I run webdriver-manager update and webdriver-manager start before running the conf.js file and when I do webdriver-manager start, it looks like it's running, but also prompts me to end webdriver-manager start in order to give me control of the command line:
I/e the last line when running it is "Selenium Server is up and running"
but then to be able to type protractor conf.js, I have to enter ctrl+c and I get this back:
Attempting to shut down selenium nicely
Staying alive until the Selenium Standalone process exists
events.js:163 throw er; //Unhandled 'error' event
Error: read ECONNRESET
at exports._errnoException (util.js:1050:11)
at TCP.onread(net.js.581:26)
Terminate batch job (Y/N)?
So is webdriver-manager kicking me out and that's why protractor's conf.js file is failing?
webdriver-manager start starts the webdriver, as you say, and it is running properly. However, when you press ctrl+c to "regain control", you're actually killing the process. It's at that point that webdriver stops, and that's why protractor won't run.
The easiest way to do this correctly is to open two command windows: run webdriver-manager start in the first one and protractor conf in the second.
First the logging refers to the conf.js file. When I look at your file I guess the problem is that you don't provide a capability to run the tests against. In other words, against what browser do you want to run your tests?
Here is an example project which has an example conf.js-file. If you change your file to this I think it should work without a problem
// An example configuration file.
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Framework to use. Jasmine is recommended.
framework: 'jasmine',
// Spec patterns are relative to the current working directory when
// protractor is called.
specs: ['spec.js'],
// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
Related
Recently, we've started to get these kind of warnings on the console when running Protractor tests:
[12252:14584:1207/223118.187:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[12252:14584:1207/223118.187:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[12252:14584:1207/223318.188:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
It feels like they happen randomly but doesn't affect the test execution.
The only problem is that they pollute the output console making it more difficult to keep track of tests being executed and test results reported by jasmine/protractor.
Is there a way to turn off this kind of chromedriver warnings?
Using Protractor 5.2.2, ChromeDriver 2.34.
We've found this --silent flag that can be passed to chromedriver executable, but could not find a way to configure protractor to pass this flag when launching chromedriver..
It seems to be an issue with chrome v63
https://github.com/SeleniumHQ/selenium/issues/5189#issuecomment-351605839
You should be able to pass the --silent flag to chromedriver in your conf file. Something like:
capabilities: {
browserName' : 'chrome',
'chromeOptions' : {
args: ['--silent']
}
}
}
"This warning message was generated by a bug in Chrome v63.
Upgrading to v64 (64.0.3282.167 as of this morning) resolves it."
versions
"nightwatch": "^0.9.16"
"chromedriver": "^2.30.1"
"selenium-server-standalone-jar": "^3.4.0"
I'm using nightwatch but that sh
I also tried with
I'm using nightwatch to run Selenium in this repo and I've tried with chrome and firefox drivers, no luck on either.
I have selenium standalone and chromedriver packages, and I know the path is right on nightwatch.conf.js:
const jar = require('selenium-server-standalone-jar')
console.log(jar.path) // logs /home/goldylucks/apps/ci-workshop/node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.4.0.jar
const chromedriver = require('chromedriver')
console.log(chromedriver.path) // logs /home/goldylucks/apps/ci-workshop/node_modules/chromedriver/lib/chromedriver/chromedriver
'selenium': {
'start_process': true,
'server_path': jar.path,
'log_path': '',
'port': 4444,
'cli_args': {
'webdriver.chrome.driver': chromedriver.path,
'webdriver.ie.driver': '',
},
},
'test_settings': {
'chrome': {
'desiredCapabilities': {
'browserName': 'chrome',
'javascriptEnabled': true,
'acceptSslCerts': true,
},
},
yet when I run the test it times out and hangs:
$ yarn e2e:ui
yarn e2e:ui v0.24.6
$ nightwatch -e chrome
Starting selenium server... started - PID: 12936
[App E2e Ui] Test Suite
===========================
✖ Timed out while waiting for element <body> to be present for 5000 milliseconds. - expected "visible" but got: "not found"
at Object.before (/home/goldylucks/apps/ci-workshop/test/ui/app.e2e-ui.js:9:8)
I tried it with the following combinations:
1. with the express server which serves the app on another terminal
2. without the express server
3. each of the above with chromedriver manually started at another terminal (I really don't think it should matter and that I should do this, just wanted to be thorough ...)
running the chromedriver manually yields the following and hangs:
$ node_modules/chromedriver/lib/chromedriver/chromedriver
Starting ChromeDriver 2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5) on port 9515
Only local connections are allowed.
I also tried running with firefox and it didn't work, which leads me to believe the problem is deeper than the chromedriver, i.e. related to selenium interacting with nightwatch.
I recall this happening a while back. I think it was that a previous instance Selenium had not closed freed port 4444 when shutting down. Try shutting down selenium and restarting.
To do that, open the following webpage manually, in the browser of your choice.
http://localhost:4444/selenium-server/driver?cmd=shutDownSeleniumServer
Then try running the script again as normal.
I am trying to run a test suite written in Protractor headlessly (using PhantomJS), but when I run the command 'phantomjs testSuiteFile.js' I get the error: ReferenceError: Can't find variable: browser. The browser variable is important in all of my tests so is there a way to allow phantomjs to find & use the browser object?
I also tried configuring my protractor config file to use phantomjs, I started selenium webdriver for phantomjs using the command recommended in the docs: phantomjs --webdriver=9134 and ran the config file with protractor protractor.conf.js. The config file is set to only run myTest.js, and I now get the error E/launcher - Error: Error: Cannot find module 'webpage'. But myTest.js works when I run phantomjs myTest.js
myTest.js:
var WebPage = require('webpage');
page = WebPage.create();
page.open('http://google.com');
page.onLoadFinished = function() {
page.render('googleScreenShot' + '.png');
phantom.exit();}
This is not how Protractor and PhantomJS work together. You need to execute protractor command from the command-line to have browser and other Protractor global variables initialized.
I'm not able to run my test cases in protractor.
It opens chrome window, write data; in the URL section but then it crashes.
Did you know why I get this error?
Running "protractor:current" (protractor) task
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Session created: count=1, browserName=chrome
Exception thrown: Keeping the Selenium server alive
C:\Users\210080088\Documents\Github\performance-central\app\src\main\resources\static\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108
var template = new Error(this.message);
^
UnknownError: Connection reset
I see you are using some sort or task runner like gulp or grunt.
Gulp:
You might be using https://github.com/mllrsohn/gulp-protractor
Update this to version 3.0.0 npm update gulp-protractor
Then update webdrivers using this task https://github.com/mllrsohn/gulp-protractor#protractor-webdriver example is in examples section of source
Grunt:
You might be using https://github.com/teerapap/grunt-protractor-runner
Update this to version 4.0.0 npm update grunt-protractor-runner
https://github.com/teerapap/grunt-protractor-runner#optionswebdrivermanagerupdate
Use this option to update your webdrivers each time the task is run
We just need to update the gulp plugins to latest version to support the Chrome54 & latest standalone Web-driver version
Update gulp-angular-protractor to version 0.2.0
npm update gulp-angular-protractor or
npm install gulp-angular-protractor#0.2.0 (in my case update didn't work)
Update gulp-protractor to version 3.0.0
npm update gulp-protractor
your gulp.js file should look like below & then you are good to go. let me know if you are still facing any issues. please excuse me if answer is not properly formatted.
var gulpAngularProtractor = require('gulp-angular-protractor');
gulp.task('e2e', function(callback) {
gulp.src(paths.tests)
.pipe((gulpAngularProtractor ({
configFile: 'protractor.conf.js',
args: [
'--suite', args.suite
],
})).on('error', function(e) {
console.log(e);
}).on('end', callback));
});
gulp.task('webdriver-update', gulpAngularProtractor .webdriver_update);
gulp.task('webdriver-standalone', ['webdriver-update'], gulpAngularProtractor .webdriver_standalone);
This is a known issue with new version of chrome > 54 , Have a look protractor#3639
to get Details on the same or try with chrome 53 or update webdriver-manager (which is not getting update you need to do it manually).
I have been playing with Intern and made my tests work in the browser. To better integrate with my current workflow I'm trying to run my tests through grunt with phantomjs. However all my attempts have failed. I've been looking at this question as a reference Intern WebDriver and PhantomJS but can't figure out all of the steps to make it work.
First of all: Is it even possible to run the tests through grunt and phantomjs?
A little bit of info:
I don't want/can't connect to Sauce Labs or a Selenium testing environment.
I want to test browser code while having jQuery as a shimmed dependency
I have Grunt 0.4.1 and phantomjs 1.9.1 installed
I'm not testing any ajax request (as the linked question is having problem with)
I'm not familiar with neither Selenium nor Sauce Lab
If it is possible to test through grunt and phanomjs, how would I go about doing it?
I guess that I have to start the GhostDriver
phantomjs --webdriver=8910
But then what are the important pieces of info in the Intern config to make this work?
define({
proxyPort: 9000,
proxyUrl: 'http://localhost:9000/',
environments: [
{
browserName: 'phantom',
version: '1.9.0',
platform: 'Linux'
}
],
webdriver: {
host: 'localhost',
port: 8910
},
maxConcurrency: 3,
useSauceConnect: false,
// ...
});
How does the environments browserName map to phantomjs? I've tried the browserNames 'phantom' as well as 'phanomjs' with different versions and platforms (running Mac 10.7)
My Gruntfile section for intern looks like:
intern: {
phantom: {
options: {
config: 'tests/intern',
reporters: ['webdriver']
}
}
}
Running this setup without any test-suite that includes browser code outputs
'ReferenceError: document is not defined' in 'node_modules/intern/lib/reporters/webdriver.js:41:19'
Adding browser tests gives 'ReferenceError: window is not defined' in 'src/vendor/jquery/jquery-1.9.1.js:9597:5'
Running it through node gives the same 'window is not defined' error.
node node_modules/intern/client.js config=tests/intern
What am I doing wrong/missing here?
There are two problems with your Gruntfile configuration:
The default run type for the Grunt task is 'client', which means it runs the Node.js client by default, not the test runner. You need to set runType: 'runner' in your Gruntfile options to run tests against your specified environments.
The webdriver reporter is for use in a browser client only and is specified automatically by the test runner when it is needed. You should typically never use it directly. The reporter you specify in the Gruntfile should be the one you want the test runner to use; the console default is usually appropriate.
These two things in combination mean that you’ve configured Intern to try to use a reporter that only works in a browser in conjunction with the test runner inside the Node.js client, hence the error. Once corrected, the remaining configuration should work properly to run on PhantomJS, assuming it is already running on localhost at port 8910.