1
我在跟隨頁面對象模式的量角器。在下面的代碼我匹配的用戶名,然後點擊編輯按鈕StaleElementReferenceError:陳舊的元素引用:元素未附加到頁面文檔即將到來當我點擊按鈕
this.clickEditButton = function (userName) {
element.all(by.repeater('u in users')).each(function (elem) {
elem.element(by.css('td:nth-child(1)')).getText().then(function (value) {
if (value == userName) {
elem.element(by.css("a[href*='#/organisation/editUser/31']")).click();
}
});
});
};
頁打開成功,但它拋出「StaleElementReferenceError:陳舊的元素參考:元素沒有被附加到頁面文件」
主要方法:
userDirectoryPage.clickEditButton('EditUser1');
userEditPage.addBasicDetails('', 'Timon', 'Thompson', '[email protected]', 'abc', 'abc', 'Testing');
有沒有人有一些建議如何解決這個問題?
@ Alecxe-的解決方案,通過返回元素文本爲我工作。非常感謝。你太棒了。 –