Commit 481c2c37 authored by Jérome Perrin's avatar Jérome Perrin

ERP5TypeFunctionalTestCase: dump the correct page in case of failure

parent 959d6669
...@@ -177,18 +177,18 @@ class WebDriverWait(_WebDriverWait): ...@@ -177,18 +177,18 @@ class WebDriverWait(_WebDriverWait):
return super(WebDriverWait, self).until(*args) return super(WebDriverWait, self).until(*args)
except: except:
logger.exception("unable to find login field, dumping the page") logger.exception("unable to find login field, dumping the page")
try:
with open(os.path.join(log_directory, 'page-screenshot.png'), 'wb') as f:
f.write(self._driver.get_screenshot_as_png())
except:
logger.exception("error when taking screenshot")
try: try:
with open(os.path.join(log_directory, 'page.html'), 'w') as f: with open(os.path.join(log_directory, 'page.html'), 'w') as f:
f.write( f.write(
self._driver.execute_script( self._driver.execute_script(
"return document.getElementById('testSuiteFrame').contentDocument.querySelector('html').innerHTML")) "return document.getElementById('selenium_myiframe').contentDocument.querySelector('html').innerHTML"))
except: except:
logger.exception("error when dumping page") logger.exception("error when dumping page")
try:
with open(os.path.join(log_directory, 'page-screenshot.png'), 'wb') as f:
f.write(self._driver.get_screenshot_as_png())
except:
logger.exception("error when taking screenshot")
raise raise
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment