mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
Revert "Temporary workaround to StaleElementReferenceException in PAN3"
This reverts commit f604598c80225218d27e95da26a2ede2aae35d78.
This commit is contained in:
parent
f604598c80
commit
60278d03f0
@ -5,7 +5,6 @@ from selenium import webdriver
|
|||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
from selenium.webdriver.common.keys import Keys
|
from selenium.webdriver.common.keys import Keys
|
||||||
from selenium.webdriver.support.ui import Select
|
from selenium.webdriver.support.ui import Select
|
||||||
from selenium.common.exceptions import StaleElementReferenceException
|
|
||||||
|
|
||||||
class PAN3(PandoraWebDriverTestCase):
|
class PAN3(PandoraWebDriverTestCase):
|
||||||
|
|
||||||
@ -41,23 +40,12 @@ class PAN3(PandoraWebDriverTestCase):
|
|||||||
driver.find_element_by_xpath('//*[@id="menu_tab"]//a[contains(@href,"ver_agente")]').click()
|
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
|
element_text = refresh_N_times_until_find_element(driver,5,"table1-1-7",how=By.ID).text
|
||||||
|
|
||||||
max_retries = 3
|
try:
|
||||||
i = 1
|
self.assertEqual("1", element_text.lstrip().rstrip()) # The lstrip.rstrip is done because if not, this error is raised: "'1' != u'1 '"
|
||||||
element_text = ""
|
except AssertionError as e:
|
||||||
|
self.verificationErrors.append(str(e))
|
||||||
|
|
||||||
|
|
||||||
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))
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user