I have a protractor config file as follows and i use phantomjs to run the tests. It works when i use seleniumServerJar but fails when i use seleniumAddress (pointing to a hub) with a 'The driver executable does not exist' message! Is there any specific config to run phantomjs with selenium-hub?
exports.config = {
//Fails when i use this
//seleniumAddress:"http://selenium-hub.com:4659/wd/hub",
//Works when i use this selenium-standalone jar
seleniumServerJar: '../../../node_modules/protractor/selenium/selenium-server-standalone-2.45.0.jar',
framework: 'cucumber',
specs: [
'features/*.feature'
],
capabilities: {
"browserName": "phantomjs",
"phantomjs.binary.path": require("phantomjs").path,
"phantomjs.ghostdriver.cli.args": ["--loglevel=DEBUG"]
},
baseUrl: '',
rootElement: 'body',
resultJsonOutputFile: 'src/test/report.json',
cucumberOpts: {
require: 'features/steps/*_steps.js',
}
};
Related
Running Protractor E2E tests against both Chrome and IE is difficult.
I can run them separately, however I need to start/stop the respective Chrome/IE webdriver server before running each tests.
In my conf.js file, I export the config options like this :
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: [
'spec/my-spec.js',
],
directConnect: false, // false when targeting IE, and selen addr is used
multiCapabilities: [
{
browserName: 'chrome'
}
,
{
browserName: 'internet explorer',
'version': '11'
}
]
}
For the standard Chrome tests, I can kick off the Webdriver server:
> webdriver-manager start
But for IE, I discovered a way to run Webdriver IE as follows (yeah, pretty ugly):
java -Dwebdriver.ie.driver=C:\Projects\GSDashboard-E2ETests\node_modules\protractor\node_modules\webdriver-manager\selenium\IEDriverServer_x64_2.53.1.exe -jar C:\Projects\GSDashboard-E2ETests\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-2.53.1.jar
Then I just launch the Protractor tests:
protractor protractor.conf.js
I'm searching around for a cleaner and smoother way of running both IE/Chrome e2e tests in one shot.
Is there a solution to this ?
Any advice/guidance is appreciated....
****** UPDATE ******
As per answer below, trying to use seleniumArgs as follows (where I can specify the jar file OR the IEDriverServer_x64_2.53.1.exe file :
exports.config = {
//seleniumAddress: 'http://localhost:4444/wd/hub', // comment out
seleniumArgs: ['-Dwebdriver.ie.driver=C:\Projects\Dashb-E2ETests\node_modules\protractor\node_modules\webdriver-manager\selenium\IEDriverServer_x64_2.53.1.exe'],
allScriptsTimeout: 50000,
specs: [
'spec/MY-spec.js',
],
directConnect: false, // false when targeting IE, and selen addr is used
multiCapabilities: [
//{
// browserName: 'chrome',
,
{
browserName: 'internet explorer',
'version': '11'
}
]
}
BUT running the test throws this error in a windows cmd prompt:
E/launcher - The path to the driver executable must be set by the web driver.ie.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/InternetExplorer‌​Driver.
So, I still haven't figured out how to run both IE and Chrome tests (sequentially).
regards,
Bob
I had a similar problem and the solution was running this:
webdriver-manager update --ie
After that, both IE11 and Chrome instances run simultaneously with:
multiCapabilities: [
{
browserName: 'chrome'
}
,
{
browserName: 'internet explorer',
'version': '11'
}
]
include seleniumArgs: ['-Dwebdriver.ie.driver=pathtoIEdriver/IEDriverServer.exe'] property in the conf.js and remove seleniumAddress: 'http://localhost:4444/wd/hub'.If no seleniumAddress is mentioned ,then protractor will automatically start selenium server. So following will be your conf.js for running your protractor test against chrome and ie.
exports.config = {
seleniumArgs: ['-Dwebdriver.ie.driver=node_modules/protractor/selenium/IEDriverServer.exe'],
specs: [
'spec/my-spec.js',
],
directConnect: false, // false when targeting IE, and selen addr is used
multiCapabilities: [
{
browserName: 'chrome'
}
,
{
browserName: 'internet explorer',
'version': '11'
}
]
}
I am new to angularjs ,trying to test my app with karma,jasmine and protractor.
here is my conf.js:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
},
specs: ['spec.js'],
jasmineNodeOpts: {
showColors: true,
}
};
here is my spec.js
describe('Protractor Demo App', function() {
it('should have a title', function() {
browser.get('http://localhost/First-angular-App/source/');
expect(browser.getTitle()).toEqual('Firstangular app');
});
});
after running protractor conf.js I get this:
but can't run my test how can i do this??
As noted above:
The error message tells exactly why your tests are not running. This option specifies a path to your specs: ['spec.js']. Modify conf.js and set a path to a folder with your specs relative to conf.js: specs: ['tests/spec.js'] or even better specs: ['tests/**/*.js'] (will take all files in tests/ directory as test files).
Upgrading my node version to LTS(Node Website), I fixed this problem.
For the moment, I have a basic angular app, generated by "generator-gulp-angular". In this project, I have 2 tests: 1 karma-test and 1 e2e-test (using protractor). The karma-test wil run without a problem, but with the other, I encounter some issues.
I'm trying to run selenium driver with phantomJS to execute the test, and in Chrome it works, in Firefox not (because of the upgrade), but trying to run the test on phantomJS wil fail. I have already downgraded my selenium stand-alone-server but now, selenium will give the error "driver info: driver.session: unknown". I'm using selenium 2.38 and phantom 1.9.x.
Can somebody tell me what to do? Should I adapt something in the conf-files of phantomJS node-module? Should I downgrade my phantomJS? ...
This is my protractor.conf.js:
exports.config = {
//directConnect: true,
seleniumAddress: 'http://localhost:4444/wd/hub',
baseUrl: 'http://localhost:9292',
rootElement: 'body',
// Capabilities to be passed to the webdriver instance.
capabilities: {
browserName: 'phantomjs',
'phantomjs.binary.path': 'C:/Users/--------/Documents/3de_Academiejaar/Stage/GitHub_Repos/proj_Jesper2/node_modules/phantomjs/bin/phantomjs',
},
specs: [paths.e2e + '/**/*.js'],
framework: 'jasmine',
jasmineNodeOpts: {
onComplete: function () {
},
isVerbose: true,
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 30000
}
};
I setup some tests in protractor for my angular app and i wanted to run a nightly batch and see next day some reports of the tests passed or failed .. . I tried without success protractor-html-screenshot-reporter so now i want to see how to save a log . Is this save a log file?
How i could see second day the result of the tests runner ?
My current protractor conf file :
exports.config = {
seleniumAddress: 'http://imptest2:80/wd/hub',
specs: [
'../E2E/**/*.spec.js'
],
multiCapabilities: [
{
'browserName' : 'chrome',
'ensureCleanSession': 'false',
'shardTestFiles': 'true',
maxInstances:8
}
],
params: {
global: {
url: 'http://impiis/TestsServices/Client',
concern: '01'
}
},
baseUrl: 'http://impiis/TestsServices/Client',
allScriptsTimeout: 500000
};
Thank you
With this simple protractor config file, you should have protractor-html-screenshot-reporter working
var HtmlReporter = require('protractor-html-screenshot-reporter');
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['Exova.LIMS.UI.Testing/e2e/pages/**/*_spec.js'],
baseUrl: 'http://localhost:51494',
onPrepare: function() {
// Add a screenshot reporter and store screenshots to `/tmp/screnshots`:
jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: 'tmp/screnshots'
}));
}
};
It was a reporter bug it was solved : https://github.com/jintoppy/protractor-html-screenshot-reporter/pull/38
I am trying to work PhantomJS with Protractor with the web application being hosted on https. I need to specify a cert in order for this to work. Here is my protractor config file:
exports.config = {
// The address of a running selenium server.
seleniumAddress: 'http://localhost:4444/wd/hub',
// Spec patterns are relative to the location of this config.
specs: [
'spec/*.js',
'spec/**/*.js'
],
capabilities: {
browserName: 'phantomjs',
'phantomjs.cli.args':['--ssl-certificates-path=cert.p12','--ignore-ssl-errors=true']
},
// A base URL for your application under test. Calls to protractor.get()
// with relative paths will be prepended with this.
baseUrl: 'https://localhost:3000',
jasmineNodeOpts: {
onComplete: null,
isVerbose: false,
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 100000
}
};
The result from the terminal is just a lot of:
17:00:56.340 INFO - Executing: [execute script: return window.location.href;, []])
17:00:56.346 INFO - Done: [execute script: return window.location.href;, []]"
There seems to be an acceptSslCerts option that is pushed into the logs but I have no idea how to set it:
[INFO - 2014-09-30T21:00:56.239Z] Session [df2bf1e0-48e4-11e4-a415-8755c19a8d30] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"1.9.7","driverName":"ghostdriver","driverVersion":"1.1.0","platf orm":"mac-unknown-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
Protractor itself throws this error:
Error: Error while waiting for Protractor to sync with the page: {"message":"Can't find variable: angular"
Any ideas?