Feb-25-2021, 09:50 PM
Hi,
You can try to identify the elements with their index, then illiterate on the index to the last one. Use this to identify by index
You can try to identify the elements with their index, then illiterate on the index to the last one. Use this to identify by index
name=driver.find_element_by_xpath("(//*[contains(@class, 'student-name')])[1]") print(name.text)note the index [1]? you can replace it with a variable and illiterate with a For loop,else use a while loop(not soo elegant but can solve your problem)
x=1 while 1: try: name=driver.find_element_by_xpath("(//*[contains(@class, 'student-name')])[x]") print(name.text) #increment x by 1 x+=1 except Exception as e: break