java - click on Button based on Text contain in multiple Rows -
i need perform following scenario: there form data entered in multiple rows , every record has own button , need click on specific record based on email address.
html source:
<div id="daily-sales-graph"> <table class="graph" align="center"> <tbody> <tr> <th style="width: 25px;"></th> <th style="width: 170px;"> <h2 align="center" style="white-space: nowrap"> order number</h2> </th> <th style="width: 60px;"> <h2 align="center"> amount</h2> </th> <th style="width: 100px;"> <h2 align="center" style="white-space: nowrap"> order date</h2> </th> <th> <h2 align="center" style="white-space: nowrap"> last called</h2> </th> <th> <h2 align="center" style="white-space: nowrap"> security code</h2> </th> <th> <h2 align="center" style="white-space: nowrap"> customer's email address</h2> </th> <th style="width: 74px;"></th> </tr> <tr class="rowhighlight"> <td style="font:12px arial,sans-serif;background-color: maroon; color:white;"></td> <td>ord2014236247112436</td> <td>$30.00</td> <td>23-jun-2014</td> <td>23-jun-2014</td> <td>5865</td> <td>uatmigrationcust@mailinator.com</td> <td> <input type="button" value="open" name="orddetails" class="button" disabled=""disabled"" onclick="openwind('/crmprocessing/new-order-detail-ns2?customerid=20311&ordid=41203&affiliateid=2041')"> </td> </tr>
this i've tried far, selects first record only.
driver.get("http://domain.com/"); driver.findelement(by.id("username")).clear(); driver.findelement(by.id("username")).sendkeys("dinero"); driver.findelement(by.id("password")).clear(); driver.findelement(by.id("password")).sendkeys("password"); driver.findelement(by.cssselector("input[type=\"submit\"]")).click(); //new select(driver.findelement(by.id("dpapplication"))).selectbyvisibletext("cheapcallingcards"); driver.get("http://ccadmin.dinerotesting.com/crmprocessing/new-customer-orders-ns2"); driver.findelement(by.xpath("//*[@id='daily-sales-graph']/table/tbody/td[2]/td[8]/input")).click();
my advice kind of things use css selector nth-child() function.
there's jsfiddle basic exemple.
you have change value of nth-child(**i**)
Comments
Post a Comment