soup = BeautifulSoup(driver.page_source)
for each_div in soup.findAll("div", { "class" : "trapac-form-view-results tpc-results" }):
if each_div.findAll("table", {"class": "sticky-enabled table-select-processed tableheader-processed sticky-table"})[1]:
for child0 in each_div.findAll("table", {"class": "sticky-enabled table-select-processed tableheader-processed sticky-table"})[1]:
if child0.name == "table":
print("2")
child = child0.findChildren()
for child in child0:
if child.name == "tbody":
child1 = child.findChildren()
the code above perfectly fine but when the table[1]
tag is not available it gives me IndexError
IndexError: list index out of range
i tried try n catch not succeeded
how i can put condition in such a way that if table[1] does not exist i should be out of complete loop and look for next variable
help appreciated