I am trying to automate an AngularJS application using Selenium in python. I am trying to find an element with ng-modal. I have seen some post related to Java which specifies that you can use the following statement
"//input[@ng-model='yourName']"
I am trying to do the same in python
(By.XPATH, "//*/select[@ng-model='yourName']")
But I am unable to find the element. Am I missing something or is there is some other way of doing it?
Since, this is an Angular application and python-selenium does not natively wait for Angular to "settle down" (as, for instance, protractor
or pytractor
), you need to explicitly wait for the element to become present:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
wait = WebDriverWait(driver, 10)
elm = wait.until(EC.presence_of_element_located((By.XPATH, "//select[@ng-model='yourName']")))
See also:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With