Revert "Temporary workaround to StaleElementReferenceException in PAN3"

This reverts commit 066d4ffd8a.
This commit is contained in:
axl89 2016-05-27 02:55:15 +02:00
parent 066d4ffd8a
commit 8baf02322d
1 changed files with 6 additions and 18 deletions

View File

@ -5,7 +5,6 @@ from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import StaleElementReferenceException
class PAN3(PandoraWebDriverTestCase):
@ -41,23 +40,12 @@ class PAN3(PandoraWebDriverTestCase):
driver.find_element_by_xpath('//*[@id="menu_tab"]//a[contains(@href,"ver_agente")]').click()
element_text = refresh_N_times_until_find_element(driver,5,"table1-1-7",how=By.ID).text
max_retries = 3
i = 1
element_text = ""
while (i <= max_retries): # Temporary workaround to weird StaleElementReferenceException exceptions due Javascript altering the DOM
try:
element_text = refresh_N_times_until_find_element(driver,5,"table1-1-7",how=By.ID).text
self.assertEqual("1", element_text.lstrip().rstrip()) # The lstrip.rstrip is done because if not, this error is raised: "'1' != u'1 '"
except StaleElementReferenceException as e_stale:
i = i+1
if i > max_retries:
self.verificationErrors.append(str(e))
break
else:
next
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()