从配置中获取seleniumAddress
Protractor get seleniumAddress from config
如何从配置中获得seleniumAddress ?
我想在afterLaunch中获得seleniumAddress值。
这个例子不能工作,你能帮我修复它吗?
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['todo-spec.js']
afterLaunch: function (exitCode, seleniumAddress) {
return console.log(seleniumAddress);
}
};
案例1:如果我要运行这个命令
protractor conf.js
我应该得到
" http://localhost: 4444/wd/中心"
案例2:如果我要运行这个命令
protractor conf.js --seleniumAddress 'http://example:4444/wd/hub'
我应该得到
" http://example: 4444/wd/中心"
可以这样使用browser.getProcessedConfig()
函数:
browser.getProcessedConfig().then(function(config){
console.log(config.seleniumAddress);
});
参考:https://stackoverflow.com/a/42418510/3211332