The webpage features a user details table with a functionality to delete users. To remove a user, I must select the row based on the username and then click the "Delete" button. The structure of the HTML table is as follows:
<table id="tblUsersGrid" cellpadding="2">
<thead>
<tbody>
<tr class="aboutMeRow" data-parentid="223">
<tr>
<tr>
...
<tr>
<td class="cell cell_278 cell_NameCell">xoxo</td>
<td class="optionIcon overrideFloat orgIcon cell cell_278 gridCell"></td>
<td class="cell cell_278 gridCell">Custom</td>
<td class="cell cell_278 gridCell">qaadmin</td>
<td class="cell cell_278 gridCell">0</td>
<td class="cell gridCell">
<div class="removeAccountIcon"></div>
<td class="cell gridCell">
<div class="editAccountIcon"></div>
</td>
<td></td>
</tr>
To easily locate the desired row, I can use the following XPath:
driver.findElement(By.xpath("//td[@class='cell_NameCell'][contains(text(),'xoxo')]"))
However, I am unsure how to access the removeAccountIcon
element within that same row. While there are solutions using XPath for similar scenarios, I'm wondering if there is a CSS selector alternative to achieve this task rather than solely relying on XPath.