While creating Selenium automation tests for a website with multiple rows contained within a main DIV element, each row represented by a separate DIV. For example, if there are 5 dynamically generated rows, the HTML code structure would look like this:
<div id="mainDiv">
<div id-"div1"><table>......</table></div>
<div id-"div2"><table>......</table></div>
<div id="div3"><table>......</table></div>
<div id="div4"><table>......</table></div>
<div id="div5"><table>......</table></div>
</div>
In my test script, I am using XPath to fetch each row's div/table/tr/td elements in a loop and clicking on them to initiate a PDF download. This process works smoothly for up to 19 DIVs. However, when it comes to the 20th DIV and beyond, I encounter a "no such element" exception. Even after applying wait commands, I face an explicit condition failed issue. Does anyone have insight into whether this problem could be related to scrolling or some other factor preventing me from accessing the 20th DIV and subsequent ones?