【发布时间】:2021-01-18 03:39:24
【问题描述】:
我正在使用 WebdriverIO6 在此站点上创建一个演示:http://automationpractice.com/index.php。
我正在尝试做一个“简单”的场景。
Feature: Dashboard
Test dashboard functionalities
Background: Open dashboard page
Given I visit home page
Scenario: Open Product Detail Page of the last product in the list
When I click on the last product in the list
Then Product Detail Page of the last product opens
当我尝试单击列表中最后一个产品的“更多”按钮以打开其产品详细信息页面时,我收到element not interactable 错误。
这是我在尝试单击“更多”按钮的方法中尝试过的:
clickLastProductImage(productId: number) {
browser.waitUntilListIsDisplayed(this.popularProducts, productId, 10000);
const element = this.popularProductMoreButton(productId);
console.log("in view port", element.isDisplayedInViewport()); // this results in false
// element.scrollIntoView();
element.moveTo();
console.log("in view port", element.isDisplayedInViewport()); // BUT this also results in false
element.waitForDisplayed(); // this throws an error because the element is not displayed; without this
// I get element not interactable error
element.click();
}
这是元素的选择器:
popularProductMoreButton(productId: number): WebdriverIO.Element {
return $('#homefeatured.product_list a.button.lnk_view[href*="id_product=' + productId + '"]');
}
我尝试的任何方法都不起作用,它根本无法滚动到该元素。
只有将鼠标悬停在产品图片上才能看到“更多”按钮,这是否存在问题?
这是github上的源代码链接:https://github.com/mareru/webdriverIO-shop-demo
请帮忙!
谢谢!
【问题讨论】:
标签: typescript automation webdriver-io