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

Commit

Permalink
use is_element_visible instead of try except
Browse files Browse the repository at this point in the history
  • Loading branch information
klrmn committed Mar 30, 2012
1 parent 6e3f172 commit 37e7efb
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pages/desktop/login_page.py
Expand Up @@ -42,12 +42,7 @@ def log_in(self, user='default'):
self.selenium.find_element(*self._password_box_locator).send_keys(credentials['password']) self.selenium.find_element(*self._password_box_locator).send_keys(credentials['password'])
self.selenium.find_element(*self._log_in_button_locator).click() self.selenium.find_element(*self._log_in_button_locator).click()


error = "" if self.is_element_visible(*self._login_error_locator):
try:
error = self.selenium.find_element(*self._login_error_locator).text error = self.selenium.find_element(*self._login_error_locator).text
except NoSuchElementException, ElementNotVisibleException: error = "login failed for %s\n" % credentials['name'] + error
'''no error, do nothing''' Assert.fail(error)
finally:
if error != "":
error = "login failed for %s\n" % credentials['name'] + error
Assert.fail(error)

0 comments on commit 37e7efb

Please sign in to comment.