Skip to content
This repository was archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
Save screenshots and html when selenium error
Browse files Browse the repository at this point in the history
sinun98 committed May 26, 2021
1 parent 286c2ed commit 8731053
Showing 2 changed files with 4 additions and 4 deletions.
Binary file modified tools/chromedriver/chromedriver-windows.exe
Binary file not shown.
8 changes: 4 additions & 4 deletions tools/its.py
Original file line number Diff line number Diff line change
@@ -273,7 +273,7 @@ def driver_renew_cookies(self, driver, plz_impfzentrum):

def driver_book_appointment(self, driver, plz_impfzentrum):
timestamp = time.strftime("%Y%m%d-%H%M%S")
filepath = os.path.join(self.PATH, "log/errorselenium/")
filepath = os.path.join(self.PATH, "tools\\log\\")
url = f"{self.domain}impftermine/service?plz={plz_impfzentrum}"

self.driver_enter_code(driver, plz_impfzentrum)
@@ -288,7 +288,7 @@ def driver_book_appointment(self, driver, plz_impfzentrum):
except:
self.log.error("Termine können nicht gesucht werden")
try:
driver.get_screenshot_as_file(filepath + "errorterminsuche" + timestamp + ".jpg")
driver.save_screenshot(filepath + "errorterminsuche" + timestamp + ".png")
except:
self.log.error("Screenshot konnte nicht gespeichert werden")
pass
@@ -307,7 +307,7 @@ def driver_book_appointment(self, driver, plz_impfzentrum):
try:
with open(filepath + "errorterminauswahl" + timestamp + ".html", 'w', encoding='utf-8') as file:
file.write(str(driver.page_source))
driver.get_screenshot_as_file(filepath + "errorterminauswahl" + timestamp + ".jpg")
driver.save_screenshot(filepath + "errorterminauswahl" + timestamp + ".png")
except:
self.log.error("HTML und Screenshot konnten nicht gespeichert werden")
pass
@@ -392,7 +392,7 @@ def driver_book_appointment(self, driver, plz_impfzentrum):
except:
self.log.error("Kontaktdaten können nicht eingegeben werden")
try:
driver.get_screenshot_as_file(filepath + "errordateneingeben" + timestamp + ".jpg")
driver.save_screenshot(filepath + "errordateneingeben" + timestamp + ".png")
except:
self.log.error("Screenshot konnte nicht gespeichert werden")
pass

0 comments on commit 8731053

Please sign in to comment.