Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Merge pull request #57 from bebef1987/remove_loop
Browse files Browse the repository at this point in the history
Change the python loop to use WebDriverWait
  • Loading branch information
stephendonner committed Apr 23, 2012
2 parents 57f72e6 + 508e0ee commit ab97745
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pages/search_page.py
Expand Up @@ -84,16 +84,16 @@ def search_for_term(self, search_term):
self.click_search()

def search_until_package_exists(self, name, package):
#120 seconds is a reasonable timeframe in which the package is expected to appear
timeout = time.time() + 120

while time.time() < timeout:
self.search_for_term(name)

if package.is_displayed:
break
else:
self.header.click_search()
WebDriverWait(self.selenium, 120).until(lambda s: self.search_and_check_if_package_exists(name, package),
"Package %s could not be found before the timeout" % name)

def search_and_check_if_package_exists(self, name, package):
self.search_for_term(name)
if package.is_displayed:
return True
else:
self.header.click_search()
return False

@property
def addons_count_label(self):
Expand Down

0 comments on commit ab97745

Please sign in to comment.