를 기다리고 내가 각도기를 사용하고 있는데 내가 browserstack 내 테스트를 실행할 때 다음과 같은 오류를받을없이 다음 테스트로 이동각도기는
StaleElementReferenceError: stale element reference: element is not attached to the page document
또는 내가 beforeAll
Error: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By.cssSelector ...
에 무엇에 따라 들어
describe('...',() => {
it('...',() => {
expect(element.all(by.css(...)).count()).toBe(9);
expect(element.all(by.css('.items').get(0).isDisplayed()).toBeTruthy();
});
}
describe('',() => {
beforeAll((/* done */) => {
element(by.css('.go-home').click(); // .then(done);
//browser.driver.get('/');//.then(done);
});
...
});
: 여기
오류를 일으키는 코드입니다 어떤 이유로 beforeAll
가 계속 진행되고 URL이 변경되고 이전의 it
은 여전히 실행 중입니다 (오류를 기반으로 한 것 같습니다).
이제는이 작품을 해킹 할 수있었습니다. 작동 이제
describe('...',() => {
it('...', (done) => {
expect(element.all(by.css(...).count()).toBe(9);
element.all(by.css(...)).get(0).isDisplayed().then((state) => {
expect(state).toBeTruthy();
done();
});
});
}
describe('',() => {
beforeAll(() => {
element(by.css('.go-home').click(); // works
//browser.driver.get('/'); // still fails
});
...
});
을 다음과 같이 나는 it
에 done
을 추가했습니다. 그러나 browser.driver.get('/')
을 사용하면 다시 실패합니다.
일반적으로 done
을 it
에 추가 할 필요가 없습니다. 내 질문에 : 무엇이 잘못 되었나요? protractor.config.js :
exports.config = {
chromeDriver: '../node_modules/protra...medriver_2.25',
seleniumServerJar: '../node_...-server-standalone-2.53.1.jar',
exclude: [],
specs: [
'../test/e2e/**/*.js'
],
multiCapabilities: [
{
build: 'test',
project: 'ABC',
browserName: 'firefox',
//browserName: 'chrome',
os: 'Windows',
os_version: '10',
directConnect: true
}],
debug: true,
maxSessions: 1,
framework: 'jasmine2',
onPrepare: function() {
browser.driver.manage().window().setSize(1024, 768);
// Register helpers
require('../test/framework/jasmine2');
var disableNgAnimate = function() {
angular
.module('disableNgAnimate', [])
.run(['$animate', function ($animate) {
$animate.enabled(false);
}]);
};
var disableCssAnimate = function() {
angular
.module('disableCssAnimate', [])
.run(function() {
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '* {' +
'-webkit-transition: none !important;' +
'-moz-transition: none !important' +
'-o-transition: none !important' +
'-ms-transition: none !important' +
'transition: none !important' +
'}';
document.getElementsByTagName('head')[0].appendChild(style);
});
};
browser.addMockModule('disableNgAnimate', disableNgAnimate);
browser.addMockModule('disableCssAnimate', disableCssAnimate);
}
};
감사이 지적에 대한 모든 약속이 해결 될 때까지
는 사실 기다려야 각도기를 트리거하는 솔루션에
browser.waitForAngular();
을 시도하는 것이 좋습니다. 불행하게도 나는 이것을 더 이상 확인할 수 없다. 왜냐하면 나는 Angular로 이동했기 때문이다 :) –