【发布时间】:2019-07-16 18:51:06
【问题描述】:
我需要从页面中的特定元素中获取文本,这些元素只有唯一的标签“ng-bind="$Gadget.customerSegmentation”,并且元素位置可能会根据场景进行更改
我尝试在下面查找元素,但有时它有时不起作用。
@FindBy(xpath = "//div[@ng-bind='$Gadget.customerSegmentation']")
WebElement Customer;
<div class="form_group inline_block" style="width:30%;">
<div class="form_label ng-binding" style="width:30%;">Cust Segmentation:</div>
<div class="form_control ng-binding" title="Low" ng-bind="$Gadget.customerSegmentation" style="width:65%;float:right;">Low</div>
</div>
即使位置改变也能找到元素。
【问题讨论】:
标签: java angularjs selenium xpath css-selectors