May-14-2021, 08:26 AM
I try to scrape a table and read specific TD in Table in each row. But for some reasons it fails at the last step. What I'm doing wrong?
content = driver.find_element_by_id("searchResultTable").find_elements_by_tag_name("tr")
for contents in content:
pop(contents.find_elements_by_tag_name("td")[9].text, "Value of 9th")this example works, but it's a bit lame to loop through every TD until the index match. There should be a way to contact a TD directly with [Index]content = driver.find_element_by_id("searchResultTable").find_elements_by_tag_name("tr")
for contents in content:
td = contents.find_elements_by_tag_name("td")
for ind, ttd in enumerate(td):
if ind == 9:
pop(ttd.text, "Value of 9th")
