我的html代码看起来像这样
<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
<div class="ui-dialog-buttonset">
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false">
<span class="ui-button-text">Delete</span>
</button>
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false">
<span class="ui-button-text">Cancel</span>
</button>
</div>
我需要使用我的网络驱动程序脚本单击此处的删除按钮
我假设您正在使用Selenium Webdriver,xpath是一个选项。使用基于xpath
和文本的搜索
//span[.='Delete']