0

It's clickable when i login without automazied test even it's a text

I tried :

element2 = WebDriverWait(driver, 300).until(EC.presence_of_element_located((By.XPATH, '/html/body/app-root/app-inquiry-main/div[2]/div[2]/div[2]/div[2]/div/app-tuselection/div/div[2]')))
element2.click()

Snapshot:

enter image description here

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

1 Answers1

0

The desired element is a Angular element, to click element instead of presence_of_element_located() you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • Using CSS_SELECTOR:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "li.navlinks.ng-star-inserted > div > span"))).click()
    
  • Using XPATH:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//li[@class='navlinks ng-star-inserted']//span[text()='050 ENGINE ATTACHMENT PARTS']"))).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