-2
while len(driver.find_elements(By.XPATH,"//*[@title='Next page']"))!=0:

The element is not found (and the while loop skept), I tried adding a timer

ui.WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.XPATH,"//*[@title='Next Page']")))

Still impossible to make selenium recognize the element. I don't think I saw anything that looked like an iframe on the source (I might have missed it).

Tantalus
  • 29
  • 5

1 Answers1

1

Instead of presence_of_element_located() you need to induce WebDriverWait for the element_to_be_clickable() and you can use the following locator strategy:

ui.WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,"//*[@title='Next Page']"))).click()
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • To start the loop I would first need to check if there is a 'next page' element. If so I need to click on the next page element once I am inside the while loop. My problem is in testing the presence of this element. – Tantalus Feb 23 '22 at 15:52
  • 1
    Did you try the code in the answer? Are you still facing the same issue? – undetected Selenium Feb 23 '22 at 15:57