html - 如何使用 selenium webdriver 单击插入标签下的按钮

标签 html css xpath webdriver

在单击插入标记内的停止按钮方面需要帮助。尝试使用 Xpath、名称和值。插入标签中没有ID

driver.findElement(By.xpath("html/body/div[1]/div/table/tbody/tr/td/table[5]/tbody/tr[3]/td[1]/form/表[2]/tbody/tr[9]/td[2]/input")).click(); - 没用

<body>
<noscript/>
<!--/DO NOT REMOVE/-->
<!-- End SiteCatalyst code version: H.22. -->
<!--END HTML HEADER-->
<script type="text/javascript">   $(document).ready(function () { SLM.ON.FWF.HTMLPage.initialize(); }) </script>
<div class="DIVBackGround">
<div class="DIVPrimaryArea">
<noscript> <table border="0" cellspacing="0" cellpadding="0" width="762"> <tr> <td width="324"></td> <td width="416"> <font color="red">Your browser's security settings do not allow JavaScript. You must change the settings to support JavaScript in order to use this application.</font> </td> </tr> </table> </noscript>
<!-- PARENT CONTAINER TO MANAGE WIDTH OF SECTIONS-->
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td>
<!--BEGIN HEADER-->
<table class="TableHeader" cellspacing="0" cellpadding="0" border="0" width="1012">
<table cellspacing="0" cellpadding="0" border="0" width="1012">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<table cellspacing="0" cellpadding="0" border="0" width="1012">
<!--END HEADER-->
<!--BEGIN WORKSPACE -->
<table class="TableBody" cellspacing="0" cellpadding="0" border="0" width="1012">
<tbody>
<tr>
<tr>
<tr>
<td>
<form name="mainform" method="POST" action="/QUERY/?CharSet=ENGLISH&AppMode=SLM&TS=5%2f30%2f2017+10%3a53%3a26+AM" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<input name="SessionID" value="511036a7eec646b79ef2fe388928dd39" type="hidden"/>
<input name="StateID" value="431DCC44-5ED0-46EF-A42A-CB3FDE441083:3cbf085a-eb1a-4360-a35d-0c110a9593a0" type="hidden"/>
<input name="EntryPointName" value="" type="hidden"/>
<input name="Selection" value="SearchAgain" type="hidden"/>
<input name="Key" value="" type="hidden"/>
<input name="Name" value="" type="hidden"/>
<input name="PrevPage" value="ServicingLoanSummary" type="hidden"/>
<input name="PageStack" value="" type="hidden"/>
<table cellspacing="0" cellpadding="0" border="0" width="762">
<table cellspacing="0" cellpadding="0" border="0" width="762">
<tbody>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<td/>
<td class="NavigationButtons" colspan="3">
<input class="ButtonLabel" name="btnDiscontinue" value="Discontinue" onclick="SLM.ON.QUERY.SubmitPage('Discontinue')" type="button"/>
</td>
</tr>
</tbody>
</table>

最佳答案

你可以试试这个吗? driver.findElement(By.xpath("//input[contains(@value, 'Discontinue')]")).click();

关于html - 如何使用 selenium webdriver 单击插入标签下的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44270146/

相关文章:

xml - 如何使用xpath从节点获取属性值?

java - 如何使用 xpath 获取对象列表中的所有值?

html - XPath - 除标题中的元素外的所有元素

javascript - 鼠标悬停时图像增长

html - 我们可以做些什么来使 1 个 flex 元素可调整大小和一个绝对长度?

javascript - 遍历 div 以更改特定子项的背景颜色

css - 缩放 SVG 剪切蒙版而不缩放被剪切的元素

javascript - 使用自定义复选框,在其更改的事件上调用函数

html - 在小 div 中居中大图像,溢出可见

html - chrome 中的问题,div 中的 HTML 表单