For loop taking only the first df item, and xpath not returning value

Asked

Viewed 36 times

-2

I think the loop only takes the first number of the df print(span) appears 2, and xpath is returning empty in print(lucro_el), tried with the print(len(lucro_el)) and the answer was 0

span_index = {'Number' : [2, 5, 8, 11, 14]}
span_in_df = pd.DataFrame(span_index)
for i, span in enumerate(span_in_df):
     spans = span_in_df.loc[i, 'Number']
     print(spans)
     lucro_el = driver.find_element_by_xpath(
                "//html/body/main/div[7]/div/div/div[2]/div[1]/div/table/tbody/tr[11]/td[" + str(spans) + "]/span").text
     print('lucro pego')
     print(lucro_el)
     print(len(lucro_el))
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.