Is there a way to select the paragraph tag for B (or C) by utilizing nth-child or nth-of-type in Selenium WebDriver?
<tr>
<td>
<p class="myClass">A</p>
</td>
</tr>
<tr>
<td>
<p class="myClass">B</p>
</td>
</tr>
<tr>
<td>
<p class="myClass">C</p>
</td>
</tr>
Context: I am exploring automation testing with Selenium WebDriver, and faced issues with selecting elements using standard CSS selectors like nth(i).
While I can successfully select the first element, I encounter difficulties with selecting the nth element. This could be due to nesting.
These attempts have failed:
.myClass:nth-of-type(2) (locator not found, per Selenium IDE)
.myClass:nth-child(2) (locator not found, per Selenium IDE)