Saturday, 7 September 2013

Wait until an element is active, selenium

Wait until an element is active, selenium

Using Selenium webdriver 2, I'm faced with the following problem:
I localize an element by
find_element_by_link_text("Archive")
This is an HTML of the element when unclicked:
<a onclick="Event.GetDataEvent(226780, 'LH', 19, 19, '',
'http://www.example.com/');"
href="javascript:void(0);">Archive</a>
When clicked it turns into (notice class="active"):
<a class="active" onclick="Event.GetDataEvent(226780, 'LH', 19, 19, '',
'http://www.example.com/');"
href="javascript:void(0);">Archive</a>
I want to wait for the element to be class="active". I think the way to go
is by using WebDriverWait but how do I actually tell selenium to wait
until
find_element_by_link_text("Archive") (and no other link_text) has
class="active" ?

No comments:

Post a Comment