From 5aa6e742bf1117641cb7ccd6a07bbd02e247f044 Mon Sep 17 00:00:00 2001 From: axl89 Date: Fri, 27 May 2016 01:01:59 +0200 Subject: [PATCH] Fixed some weird StaleElementException error --- tests/console/PAN3.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/console/PAN3.py b/tests/console/PAN3.py index c790d1e775..0c86ff1d51 100644 --- a/tests/console/PAN3.py +++ b/tests/console/PAN3.py @@ -38,10 +38,14 @@ class PAN3(PandoraWebDriverTestCase): driver.find_element_by_id("text-name").send_keys("ping test") driver.find_element_by_id("submit-crtbutton").click() driver.find_element_by_xpath('//*[@id="menu_tab"]//a[contains(@href,"ver_agente")]').click() - element = refresh_N_times_until_find_element(driver,5,"table1-1-7",how=By.ID) + element_text = refresh_N_times_until_find_element(driver,5,"table1-1-7",how=By.ID).text - try: self.assertEqual("1", element.text.lstrip().rstrip()) # The lstrip.rstrip is done because if not, this error is raised: "'1' != u'1 '" - except AssertionError as e: self.verificationErrors.append(str(e)) + try: + self.assertEqual("1", element_text.lstrip().rstrip()) # The lstrip.rstrip is done because if not, this error is raised: "'1' != u'1 '" + except AssertionError as e: + self.verificationErrors.append(str(e)) + + if __name__ == "__main__": unittest.main()