Skip to content
Advertisement

Looping through table rows when the url doesn’t change with selenium

selenium

This is what the problem looks like. I’m supposed to go through this table with 2995 rows. Each of these rows can be double clicked which opens up a details page for it. I’m supposed to open a row, check some value from the details page, and go to the next one, doing the same. The table itself has no incremental identifier, the ID in the first column is a random string. How would I go about this?

Advertisement

Answer

See if this works:

tableRows = driver.find_elements_by_xpath("//div[@class='v-data-table__wrapper']/table/tbody/tr")
for tr in tableRows:
    tr.click()
//do the check on the details page
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement