0

I am trying to automate going to the next product list in the following website.

https://munnalaldawasaz.in/categories/essential-oils

I don't see any change in the url while visiting the next page.

I have attached an image for element that is to be clicked.

Image:

Image

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

0

To click on the element > you can use either of the following Locator Strategies:

  • Using xpath:

    driver.find_element(By.XPATH, "//article/div[@class='toolbar']//div[@class='pages']//ul[@class='pagination']//a[text()='Last']//preceding::li[1]/a").click()
    

Ideally, to click on the element you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • Using XPATH:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//article/div[@class='toolbar']//div[@class='pages']//ul[@class='pagination']//a[text()='Last']//preceding::li[1]/a"))).click()
    
  • Note: You have to add the following imports :

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352