前幾天 Protractor 的課程終於上完了,有學員就馬上在自己的網站上練習 E2E 的自動化測試。 寫了下方的程式碼

failed test
  • ts
1
2
3
4
5
6
7
8
9
it('should click the link', async () => {
await browser.waitForAngularEnabled(false);
await browser.get('https://xxx.sample.com/#/');
const link = element(by.className('anticon-down'));
const linkIsEnabled = EC.elementToBeClickable(link);
// 點擊連結之前,先確認連結能被點擊!!!
await browser.wait(linkIsEnabled, 10000);
await link.click();
});

這程式碼看起來合情合理,結果在 link.click() 出現錯誤。 錯誤訊息大概是呈現這樣子。
Failed: unknown error: Element < i class="anticon-down">< / i > is not clickable at point (165, 720). Other element would receive the click: < div class="Loader__foreground" style="display: table; width: 100%; height: 100%; text-align: center; z-index: 20; color: white;">...< /div>

Continue reading
  • page 1 of 1
Author's picture

Miles

I’m a person who is enthusiastic about Coding, and that’s my job by the way.


Web Developer


Taiwan