python 2.7 - Alternative of visibility of element located in selenium 2.0 that checks the presence of an element on the DOM? -


i have problem in framework instead of using static sleeps try wait visibility of element. thing visibilty of element checks presence of element on dom, return true in system page not loaded yet. happens true when checking visibility of element set values. these values reset when actual page loaded.

my question can use instead of static sleeps wait actual page (not dom) loaded visibility of element not working me?

p.s. i'm using selenium webdriver python 2.7

/adam

the expected_conditions.visibility_of_element_located(locator) method check both - presence of element in dom, , visibility (element displayed height , width greater zero).

ideally, driver.get(url) method should automatically wait full page loaded before moving on next line. however, might not behave expected, in case, web application being tested uses ajax calls/actions (as although page has loaded ajax actions still in progress). in such scenario, can use below wait stability before performing action(s) on desired webelements.

# create firefox driver driver = webdriver.firefox()  # navigate app url driver.get('http://www.google.com')  # keep watch on jquery 'active' attribute webdriverwait(driver, 10).until(lambda s: s.execute_script("return jquery.active == 0"))  # page should stable enough now, , can perform desired actions elem = webdriverwait(driver, 10).until(expected_conditions.visibility_of_element_located((by.id, 'id')))  elem.send_keys('some text') 

hope helps..


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -