1

Hi I am trying to get count of all the rows in Html table using python Selenium. My table Contains 155 rows,But my code returns only 30 as rowcount. I have checked inspect element it is showing only 30 rows,once i scroll down old rows are deleted from inspect element and new rows were added.So it is maintains 30 as constant.In this case how can take 155 as rowcount and traverse all the rows

tbody=driver.find_elements_by_xpath("gridview-1161-body")
rowCount=len(driver.find_elements_by_xpath("//tbody[@id='gridview-1161-body']/tr"));
rows = WebDriverWait(driver, 10).until(EC.visibility_of_all_elements_located((By.XPATH, "//tbody[contains(@id,'gridview-1161-body')]/tr")))
print(rowCount)

And Using for loop i'm trying to give values to td,In this case it is failing once it reached 21rows.

rownum=0
for rownum in range(rowCount):
        element=rows[rownum].find_element_by_xpath(".//td[contains(@class,'rp-grid-editable-cell  rp-grid-editable-cell') and @role='gridcell']")
        element.click()
        driver.find_element(By.ID, "numberfield-1243-inputEl").send_keys('1')
        driver.find_element(By.ID, "numberfield-1243-inputEl").send_keys(Keys.ENTER)
Divya Mani
  • 203
  • 1
  • 3
  • 15

0 Answers0