Reputation: 233
I am attempting to automate a web application using the InternetExplorer driver in Python Selenium Webdriver. The web app indicates that it is fetching results by displaying a 'transitory' DIV, which contains a spinning circle icon.
So, if I automate searching for an item in the web application, as soon as I fire a click on the search button, the DIV becomes visible, then disappears when the results have been returned.
I know the class of the DIV ('loading-indicator'), I'm wondering if there is a way through Python Selenium to test for the DIV becoming visible, then test for the DIV becoming invisible as a way of then firing follow-on activity?
Upvotes: 0
Views: 51
Reputation: 1484
You could easily do it with is_displayed method :
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('yourPage.html')
element = driver.find_element_by_class('loading-indicator') #this element is visible
if element.is_displayed():
print "Spinning and spinning and spinning"
else:
print "Nothing spinning here"
Upvotes: 1