Html 如何使用SeleniumWebDriver单击Insert标记下的按钮
单击插入标记内的“停止”按钮需要帮助。尝试使用Xpath、名称和值。插入标记中没有ID findElement(By.xpath(“html/body/div[1]/div/table/tbody/tr/td/table[5]/tbody/tr[3]/td[1]/form/table[2]/tbody/tr[9]/td[2]/input”)。单击()不起作用Html 如何使用SeleniumWebDriver单击Insert标记下的按钮,html,css,xpath,webdriver,Html,Css,Xpath,Webdriver,单击插入标记内的“停止”按钮需要帮助。尝试使用Xpath、名称和值。插入标记中没有ID findElement(By.xpath(“html/body/div[1]/div/table/tbody/tr/td/table[5]/tbody/tr[3]/td[1]/form/table[2]/tbody/tr[9]/td[2]/input”)。单击()不起作用 <body> <noscript/> <!--/DO NOT REMOVE/--> <!-- E
<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>
$(document).ready(函数(){SLM.ON.FWF.HTMLPage.initialize();})
浏览器的安全设置不允许使用JavaScript。要使用此应用程序,必须更改设置以支持JavaScript。
你可以试试这个吗<代码>driver.findElement(By.xpath(//input[contains(@value,'contract')]))。单击()代码>尝试使用以下命令:
driver.findElement(By.cssSelector("form table tr:nth-child(9) td>input")).click()
或者使用JavaScriptExecutor
WebElement yourElement = river.findElement(By.cssSelector("form table tr:nth-child(9) td>input"));
((JavascriptExecutor) driver).executeScript("arguments[0].click",yourElement);
嗨,谢谢你的回复。我试过这个。它不起作用。并将´@value、'contracte''替换为´@type、'button''。它能工作吗?你使用的是什么驱动程序(Chrome、Firefox等等?),你有错误/异常吗?嗨,Kushal。谢谢你的回复。这两个选项都不起作用转到开发者选项>控制台>键入
$$(“表单表tr:nth child(9)td>input”)
并共享结果快照