我需要点击"Cancel"按钮。所以我试着写一个x-path,看起来像这样:
//button[text()='Cancel']但由于两个元素符合以下条件,因此确定了两个元素,尽管其中一个元素是隐藏的:
<button type="button" class="gwt-Button button_action_id_9135994370013188418_9135995360013188733_compositepopup_3 TableCtrl-button cancel-button">Cancel</button>
<button type="button" class="gwt-Button button_action_id_9149469526113774095_9149539697213772969 TableCtrl-button cancel-button" aria-hidden="true" style="display: none;">Cancel</button>有没有一种方法可以识别没有像'aria-hidden'这样的标记的元素?
发布于 2018-02-27 23:50:00
尝试使用下面的XPath来匹配所需的(不是隐藏按钮):
//button[text()='Cancel' and not(@aria-hidden='true')]https://stackoverflow.com/questions/49012618
复制相似问题