Selenium Python WebDriverWait

Jbn1233
May 31, 2023

--

Sometimes “presence_of_element_located” just mean that element is located ,but may not ready to use try “element_to_be_clickable” instead.

Example:

print "loooking for password input..."
try:
# ea=WebDriverWait(driver,10).until(EC.presence_of_element_located((By.XPATH,'/html/body/div[2]/div[5]/div[5]/div[1]/div[3]/div[2]/div[2]/input')))
ea=WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,'/html/body/div[2]/div[5]/div[5]/div[1]/div[3]/div[2]/div[2]/input')))
except TimeoutException:
print "password input not found!"
driver.quit()
sys.exit
exit()

that’s all.

--

--

Jbn1233
Jbn1233

Written by Jbn1233

Very short and simple notes for CKA/SRE and may not works on your environment | jbn1233@gmail.com | Bangkok, Thailand |

No responses yet