How should I use driver.find_elements_by_xpath()
to get all the data-row elements that I boxed in the picture.
I do not need the other tr
tags. In my current code I just check all the tr
tags and then throw out the ones that raise a NoSuchElementException
but that gets very slow since my implicit_wait()
is set to 15 seconds and the table is about 100 rows long, see below for code snippet.
table_element = t_find_element_by_id(driver, "table_name")
body_element = t_find_element_by_tag_name(table_element, "tbody")
row_elements = t_find_elements_by_tag_name(body_element, "tr")
for item in row_elements:
column_elements = t_find_elements_by_tag_name(item, "td")
try:
a_tag_element = t_find_element_by_tag_name(columns[0], 'a')
except NoSuchElementException:
continue