I need to do assertion with the total of table and to do this when I am writing XPath for total in image table its not working for all the scenario. I know the reason because the table is dynamic so sometimes its have only 1 Image and sometime its have 5 Image so I am having difficulty to wrote x-path which works for all the scenario.
For the attached image I have written : enter image description here WebElement totalElement = driver.findElement(By.xpath("//*[@id="image_table"]/tbody/tr[5]/td[4]")); its running fine but when the table size changes. it failed.
for reference the webpage design is as below,
***<table class="table table-bordered table-striped table-hover display" id="image_table">
<tr>
<td colspan="2" class="text-right">Total</td>
<td class="text-center">1,650</td>
<td class="text-center">19,936</td>
<td class="text-center">21,586</td> (trying to write xpath for this total)
</tr>***