I am using HTMLUnitDriver for data extraction. I have a table with rows which is spread on more pages. Like for 50 results, page 1 contains 24 results, page 2 also contains 24 results and page 3 contains 2 results, which all sumed up make 50 results. The problem that I have is that when I try to take all the rows from a page, I might not get all (24 rows), I could get any number less than 24, which I don't want. I always want 24 rows, except for the last page which has less than 24 rows.
The rows in the table have the following form:
<tr id="row28984" class="line_1" onclick="selectRow(28984);Field.activate('qty28984')">
<tr id="row93700" class="line_2" onclick="selectRow(93700);Field.activate('qty93700')">
I used xpath for taking them:
xpath1: //*[@id='resultTable']/tbody/tr
xpath2: /html/body/center/table/tbody/tr[3]/td/form/table[2]/tbody/tr
I also used cssSelector like this:
webDriver.findElements(By.cssSelector(".line_1,.line_2")
but none of what I tried is working. I also tried to wait for the page to completly load:
webDriver.manage().timeouts().pageLoadTimeout(20, TimeUnit.SECONDS)
and tried to wait for the rows to load but nothing changed.
One thing that I think it might work is putting Thread.sleep(1000) but I don't want to do this because it's not a best practice in my case and I want to use something offered by Selenium Webdriver.
Is there a solution to my problem?