How to read parameter's value, present in conf.js file of protractor in specs

后端 未结 1 1773
悲哀的现实
悲哀的现实 2021-01-24 20:37

Ex: conf.js

exports.config = {

    directConnect: false,

    // multiCapabilities: [{
    //     browserName: \'firefox\'
    // }, {
    //     browserName: \         


        
相关标签:
1条回答
  • 2021-01-24 21:24

    Yes, you can access all the config values using browser.getProcessedConfig.Check here for more details

    An example below

    describe('test', function(){
        it('test', function(){
            browser.get('http://www.way2automation.com/angularjs-protractor/registeration/#/login');
            browser.getProcessedConfig().then(function(config){
                console.log(config.baseUrl) // Print Url
                console.log(config.specs) // Prints specs
                console.log(config.capabilities) // Prints capabilities
            })
            browser.sleep(10000)
        });
    });
    

    In case you are looking to make it re-usable

     this.getConfParameterValue = function() {
         return browser.getProcessedConfig().then(function(config) {
               return config.directConnect;
         }) 
     }
    
    0 讨论(0)
提交回复
热议问题