![](/img/trans.png)
[英]Jquery Selector getting previous aria-selected element, not current
[英]Selenium / Java : How to write element locator for an element with aria-selected=false
我们无法在 HTML 页面上找到并单击“aria-selected”=“false”的元素。 我们尝试了不同的方法来编写 xpath 定位器和 css 选择器,但它们都不起作用。 在页面上进行更多检查时,我们发现该元素中有一个“aria-selected="false",当我们单击它并显示结果时,该值更改为“aria-selected="true"
我们已经尝试过以下 xpath:
(".//*/span[@class='tab-button-text'][contains(text(),'Orders')]")
注意:即使使用哪个框架都没有关系,我们正在使用这个元素。 但是我想提一下,我们一直在尝试将它用于两个独立的框架,例如
Element 接口的ariaSelected属性反映了aria-selected
属性的值,该属性指示当前“已选择”的元素 state 具有选定的 state。
值:具有以下值之一的 DOMString:
此WebElement属性的选定/未选定 state 不会影响您的测试。
要定位元素,您可以使用以下任一Locator Strategies :
xpath :
("//span[@class='tab-button-text' and contains(text(),'Orders')]")
选择器:
("div.tabbar.show-tabbar > a.tab-button.has-title.has-icon span.tab-button-text")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.