javascript - 量角器元素在点 (x, y) 处不可点击
问题描述
这是我一段时间以来最沮丧的一次。我正在用 Javascript(量角器)编写测试,我只想让它点击我页面上的元素。可能有 10%(或更少)的时间它实际正常工作,另外 90% 的时间我得到这个错误:
Failed: element click intercepted: Element is not clickable at point (x,y)
是的。我看过其他关于这个的帖子,我已经尝试了所有的“解决方案”,但没有一个能让它 100% 的工作。
it('Full Width Video test', async() => {
const fwv = await blocks.fullWidthVideo;
browser.executeScript("arguments[0].scrollIntoView(true);", fwv);
await expect(await fwv).toBeDisplayed();
await expect(await blocks.fullWidthVideoImg).toBeDisplayed();
// tried this
// browser.manage().timeouts().implicitlyWait(10000)
// also tried this
// const EC = new protractor.ProtractorExpectedConditions();
// await browser.wait(EC.elementToBeClickable(
// element(blocks.fullWidthVideoImg))),
// 5000,' item is not clickable after 5 seconds');
// also also tried this
// let ele = browser.findElement(blocks.fullWidthVideoImg));
// browser.actions().mouseMove(ele).click().perform();
await blocks.fullWidthVideoImg.click();
await expect(await blocks.fullWidthVideoIframe).toBeDisplayed();
});
export class Blocks {
// Full Width Video
get fullWidthVideo() {
return element(by.xpath('//div[@data-test="fullwidthvideo"]'))
}
get fullWidthVideoImg() {
const fwv = this.fullWidthVideo;
return fwv.element(by.xpath('./div[@data-test="video-img"]')))
}
get fullWidthVideoIframe() {
const fwv = this.fullWidthVideo;
return fwv.element(by.xpath('./div[@data-test="video-iframe"]')))
}
}
解决方案
推荐阅读
- c# - 如何在 .NET Framework Soap Web 服务客户端中保留十进制值
- mongodb - $dateFromString 将使用 mongodb 将月份名称转换为数字
- python - Scikitlearn Regression with Support Vector Machine score/r^2 for a specific point python
- react-native - 反应原生多选,不能选择多个值
- youtube-api - YouTube 数据 API 搜索限制
- gensim - Gensim Word2vec 模型参数调优
- java - 我收到错误 MockMultipartFile Error 415,err cast, error 400, Springboot
- android - android中的划痕/触摸问题检测
- javascript - 显示带有 json 数据的列表组
- office-js - 使用 Office.js API,如何从 excel 中的形状中删除轮廓