我有以下代码,想要找到css或xpath的元素。
<div class="arrowIconDiv" data-dojo-attach-point="arrowIconDiv">
<div class="i-arrow-double" data-dojo-attach-point="NavAreaExpander"> /div>
<div class="i-arrow-double-hover" data-dojo-attach-point="NavAreaExpanderHover"></div>
尝试了多项但无法找到并点击该元素。
(by.css(".arrowIconDiv"))
(by.css('[data-dojo-attach-point="arrowIconDiv"]'))
(by.xpath('.//div[@class="i-arrow-double-hover"][.="NavAreaExpanderHover"]'))
提前致谢
答案 0 :(得分:0)
NavAreaExpanderHover
是data-dojo-attach-point
属性的值,而不是div元素的内容。因此,不要在XPath中使用.
,而是使用属性名称:
.//div[@class="i-arrow-double-hover" and @data-dojo-attach-point="NavAreaExpanderHover"]