Inter findByXpath忽略上一个选择
我对Inter findByXpath忽略上一个选择,xpath,intern,leadfoot,Xpath,Intern,Leadfoot,我对findByXpath忽略以前的选择(使用findXxxxxXxxx命令完成的选择)有问题 我的页面对象如下所示 class DeleteModalUiComponent { constructor(private remote: Remote) { } getComponentContainer() { return this.remote.findDisplayedByCssSelector('.delete-modal');
findByXpath
忽略以前的选择(使用findXxxxxXxxx
命令完成的选择)有问题
我的页面对象如下所示
class DeleteModalUiComponent {
constructor(private remote: Remote) { }
getComponentContainer() {
return this.remote.findDisplayedByCssSelector('.delete-modal');
}
clickModalBotton(text: string) {
return this.getComponentContainer()
.findByXpath(`//button//*[contains(text(),'${text}')]`)
.then(elem => elem.click())
.waitForDeletedByCssSelector('.delete-modal');
}
}
我想根据容器的Xpath查找,但是findByXpath
忽略选择getComponentContainer()并从根目录中进行选择
在leadfoot中,API说明了以下内容:
获取此元素中与给定XPath匹配的第一个元素
选择器
但是在Xpath中使用
/
前缀会忽略此元素
Xpath中的/
前缀会忽略当前上下文元素,因为/
明确表示“从文档根目录搜索”。要在当前上下文元素中搜索,请使用/
谢谢,使用/
完成了任务