예 : conf.js
exports.config = {
directConnect: false,
// multiCapabilities: [{
// browserName: 'firefox'
// }, {
// browserName: 'chrome'
// }, {
// browserName: 'internet explorer'
// }],
specs: ['Specs/spec.js'],
seleniumAddress: 'http://localhost:4444/wd/hub',
}
명세서:
it('should be able to select the required organization', function() {
Select_Organization.selectOrganization();
//console.log(browser.seleniumAddress);
//This is where I need to read the config paramater values, but above is printing undefined.
expect(browser.getTitle()).toEqual('p3 by NextGen - CSR & Development Capital Management Platform');
});
conf.js 파일에있는 매개 변수의 값을 읽어 specs.js 파일에서 읽어 매개 변수를 기반으로 필요한 조치를 취할 수 있도록해야합니다. 이것이 가능할 수있는 방법이 있습니까?
예, 당신이 사용하는 모든에게 설정 값에 액세스 할 수 있습니다 browser.getProcessedConfig
.Check을 여기에 자세한 내용은
아래 예
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)
});
});
재사용이 가능하도록하려는 경우
this.getConfParameterValue = function() {
return browser.getProcessedConfig().then(function(config) {
return config.directConnect;
})
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다