Reputation: 203
below is my config file:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
baseUrl1: 'https://www.angularjs.org/',
capabilities: {
'browserName': 'chrome'
},
specs: ['./specs/login.spec.js'],
jasmineNodeOpts: {
showColors: true,
},
params: {
baseUrl2: 'https://www.angularjs.org/',
},
onPrepare: function() {
console.log("URL2 "+browser.params.baseUrl2);
console.log("URL1 "+browser.baseUrl1);
browser.driver.manage().window().maximize();
return browser.get('http://juliemr.github.io/protractor-demo');
},
};
When I try to access with console.log("URL1 "+browser.baseUrl1);
in onPrepare, I am getting undefined value.But Same time when I access console.log("URL2 "+browser.params.baseUrl2);
I get the desired value, I am not sure what is the problem here. Here I want to access the baseURL value which is not part of params.
please let me know what mistake I am doing here.
Upvotes: 0
Views: 899
Reputation: 586
You should use "baseUrl" variable, with its exact name.
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
baseUrl: 'https://www.angularjs.org/',
capabilities: {
...
Upvotes: 0
Reputation: 456
Actually, params are accessible through browser.params.paramName
from everywhere (onPrepare, tests files...).
But you can access the baseUrl by using exports.config.baseUrl1
if needed.
Upvotes: 1