Selenium Unable to locate element ng dropdown panel

133 views Asked by At

I am new to selenium webdriver with python.This is my first script

I am trying to select value "300-500" from dropdown but getting error "elenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@class="ng-dropdown-panel ng-select-bottom"]//div[3]"}"

I first clicked on dropdown so it will show list "

browser.find_element(By.NAME, "organization").click()

Then i write this to click on value "

time.sleep(1)
browser.find_element(By.XPATH,'//*[@class="ng-dropdown-panel ng-select-bottom"]//div[3]').click()

" enter image description here

enter image description here

1

There are 1 answers

0
Akzy On

You can try the below solution.

from selenium.webdriver.common.by
import By
from selenium.webdriver.support.ui
import WebDriverWait
from selenium.webdriver.support
import expected_conditions as EC

element = WebDriverWait(driver, 20).until(
   EC.element_to_be_clickable((By.XPATH, "//span[contains(text(),'10-50']")))  #if you want to choose 10-50

element.click();

OR

element = WebDriverWait(driver, 20).until(
       EC.element_to_be_clickable((By.XPATH, "//*[normalize-space()='10-5=0']")))  #if you want to choose 10-50
    
    element.click();