I am trying to navigate a webpage using xpath and I come up with some mixed results. This is what I use:
driver.findElement(By.xpath("//div[contains(@class, 'x-grid3-cell-inner x-grid3-col-0')]"));
This really works fine, but the problem I am facing with this is:
<div class="x-grid3-cell-inner x-grid3-col-0" unselectable="on">92300</div>
<div class="x-grid3-cell-inner x-grid3-col-0" unselectable="on">92475</div>
<div class="x-grid3-cell-inner x-grid3-col-0" unselectable="on">92476</div>
<div class="x-grid3-cell-inner x-grid3-col-0" unselectable="on">92301</div>
<div class="x-grid3-cell-inner x-grid3-col-0" unselectable="on">92474</div>
When I run this xpath in my Selenium test, I always get the first div. How to edit my xpath to retrieve the 4th div (92301) or another div that is not the first on the list?
source
share