일부 테스트를 작성하기 위해 Cucumber와 함께 각도기를 사용하고 있지만 일부 지점에서 멈추었습니다. 로그인 후 단계에서 분도기에서 제공하는 browser.get (url) 함수를 사용하여 다른 페이지로 경로를 변경합니다. 그러나 페이지가 완전히로드되기 전에 항상 반환됩니다. 나는 많은 해결책을 지금까지 시도했지만 행운이 없다. 나는 browser.wait, browser.get (url) .then (function() {//로드 할 때 코드})로 시도했지만, 0은 긍정적 인 결과를 얻는다. 주변의 모든 제안 작업이 훨씬 이해 될 것이다브라우저를 사용하여 주어진 URL이 완전히로드되기 전에 반환합니다.
// Steps will be implemented here
this.Given(/^I am logged in as user \'([^\']*)\'$/, function (user, callback) {
console.log('USER: ' + user);
browser.driver.get('https://cit-was70-l06/ipa')
browser.driver.findElement(by.xpath('my_xpath')).sendKeys(user);
browser.driver.findElement(by.xpath('my_xpath')).sendKeys(user);
browser.driver.findElement(by.xpath('my_xpath')).click().then(callback);
});
this.Then(/^The screen is shown, with title \'([^\']*)\'$/, function (title, callback) {
console.log('Title from feature file: ' + title);
var url = 'some/url/in/application/';
browser.get(url).then(function(){
// This portion executes before page is completely loaded.
// So if I try to get any element, it throws me an error.
// [15:32:13] E/launcher - "process.on('uncaughtException'" error, see
// launcher
// [15:32:13] E/launcher - Process exited with error code 199
// It works if I add static delay to wait for page load completely
// but that will not be a good solution if I have too much pages to test
callback();
});
console.log('After page laoad');
});
:
여기 내 코드입니다.
관련 항목 : [각도기 실행 후 uncaughtException] (http://stackoverflow.com/questions/38397965/uncaughtexception-after-a-protractor-run). – alecxe