Can I access parameters in my protractor configuration file?
I am not completely sure if protractor globals are set at the beforeLaunch()
stage, but they are definitely available at onPrepare()
step.
Access the params
object through the global browser
object:
console.log(browser.params.baseUrl);
Update:
Using Jasmine 2.6+, protractor 4.x, browser.params was empty, but the following worked in onPrepare()
step:
console.log(browser.baseUrl);
In case you need every single item in the entire configuration file, you can use browser.getProcessedConfig()
to do this.
onPrepare: () => {
browser.getProcessedConfig().then(console.log); // even `params` is in here
}