'How can I click a link of the first [td] based on staus of last [td] in the same [tr] using codeceptjs/javasrcipt
The expected: Select random one an assignment has status "Not start". Here is my table:
<table id="table1">
<tbody>
<tr class="odd1">
<td>
<a href="#" class="click_link"> Assignment 1 </a>
</td>
<td class="status">
In Progress
<td>
</tr>
<tr class="odd2">
<td>
<a href="#" class="click_link"> Assignment 2 </a>
</td>
<td class="status">
Not start
<td>
</tr>
<tr class="odd1">
<td>
<a href="#" class="click_link"> Assignment 3 </a>
</td>
<td class="status">
Not start
<td>
</tr>
<tr class="odd1">
<td>
<a href="#" class="click_link"> Assignment 4 </a>
</td>
<td class="status">
Not start
<td>
</tr>
</tbody>
</table>
Solution: I group [td] elements have status "Not Start" in the array, then get the parent [tr] of the first [td][0]. Finally, from [tr] I find and click the link. How to do this? Thanks a lot!
Solution 1:[1]
Worked with jquery:
I.executeScript(function() {
var abc = $("#table1 td:contains('Not Start')").parent("tr").children("td:first").children().text();
return abc;
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Potter |
