I believe this question is unique as this is specifically for Python and not related with the Java issue mentioned in the other thread.
I'm going through Selenium's documentation regarding explicit waits but I can't create code to illustrate each explicit waits use cases.
The example below works (ie returns True)
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
driver = webdriver.Firefox()
driver.get('https://www.google.com')
#match title tag
def title_is(driver, title, timeout=3):
try:
w = WebDriverWait(driver, timeout)
w.until(EC.title_is(title))
return True
except:
return False
print title_is(driver, 'Google',timeout=3)
But the example below doesn't work (I use a different explicit wait condition)
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
driver = webdriver.Firefox()
driver.get('https://www.google.com')
#try to grab <div id="als">
def presence_of_element(driver, timeout=3):
try:
w = WebDriverWait(driver, timeout)
w.until(EC.presence_of_element_located(By.ID('als')))
return True
except:
return False
I've experimented with multiple forms of syntax but I can't make any explicit wait condition to work excepted the title_is
I would really appreciate your feedback as I'm obviously missing something here.
Thanks