How to work State and City button on DemoQA practice-form? I am Unable to locate element for both state and city?

I am trying to work with filling practice form in demoQA.

Link: ” https://demoqa.com/automation-practice-form

The issue I am facing is “I’m unable to locate both State and city element”

Im getting below error: “raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {“method”:”xpath”,”selector”:” css-yk16xz-control”}”

Need suggestions!


state_container = driver.find_element(By.XPATH," css-yk16xz-control")
state_container_value = driver.find_element(By.XPATH," //div[@class=" css-1uccc91-singleValue"]")
driver.execute_script("arguments[0].scrollIntoView(true);", state_container)
state_container[0].send_keys("NCR")
state_container[0].send_keys(Keys.RETURN)
wait = WebDriverWait(driver, 30)
dropdown_state = wait.until(EC.visibility_of_all_elements_located((By.XPATH," //div[@class="css-11unzgr"]")))
dropdown_state[0].send_keys("Rajasthan")
dropdown_state[0].send_keys(Keys.RETURN)
time.sleep(3)

PracticeForm

Leave a Comment