0

Need help in Clicking the Discontinue button inside a Insert Tag. Tried using Xpath, Name and Value. There is no ID in the Insert Tag

driver.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")).click(); - did not work

<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>
1
  • What driver are you using (Chrome, Firefox, ...?), and do you get an error/exception? Commented May 30, 2017 at 19:44

2 Answers 2

0

You can try this? driver.findElement(By.xpath("//input[contains(@value, 'Discontinue')]")).click();

Sign up to request clarification or add additional context in comments.

2 Comments

Hi,Thanks for your Response. I tried this. It doesn't work.
and replacing ´@value, 'Discontinue'´ by ´@type, 'button'´. It works?
0

try using following:

 driver.findElement(By.cssSelector("form table tr:nth-child(9) td>input")).click()

OR using JavaScriptExecutor

 WebElement yourElement = river.findElement(By.cssSelector("form table tr:nth-child(9) td>input"));
 ((JavascriptExecutor) driver).executeScript("arguments[0].click",yourElement);

2 Comments

Hi Kushal. thanks for your response. Both of these doesn't work
goto developer options > console > type $$("form table tr:nth-child(9) td>input") and share the result snapshot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.