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

Commit

Permalink
fix(log): Ensure tools/log paths are constructed portably (#454)
Browse files Browse the repository at this point in the history
On Linux, the backslash in "tools\log\" was not interpreted as path
separator, so screenshots etc. ended up in the project's root directory,
named "tools\log\<filename>". Now they are named "<filename>" and stored
in the log-directory under tools.
  • Loading branch information
andreaswachowski authored Jun 13, 2021
1 parent 8970167 commit 1ae71fe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/its.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def driver_get_cookies(self, driver, url, manual):

def driver_termin_buchen(self, driver, reservierung):
timestamp = time.strftime("%Y%m%d-%H%M%S")
filepath = os.path.join(self.PATH, "tools\\log\\")
filepath = os.path.join(self.PATH, "tools", "log")

try:
self.driver_enter_code(
Expand All @@ -418,7 +418,7 @@ def driver_termin_buchen(self, driver, reservierung):
except:
self.log.error("Termine können nicht gesucht werden")
try:
driver.save_screenshot(filepath + "errorterminsuche" + timestamp + ".png")
driver.save_screenshot(os.path.join(filepath, "errorterminsuche" + timestamp + ".png"))
except:
self.log.error("Screenshot konnte nicht gespeichert werden")
pass
Expand All @@ -435,10 +435,10 @@ def driver_termin_buchen(self, driver, reservierung):
except:
self.log.error("Termine können nicht ausgewählt werden")
try:
with open(filepath + "errorterminauswahl" + timestamp + ".html", 'w',
with open(os.path.join(filepath, "errorterminauswahl" + timestamp + ".html"), 'w',
encoding='utf-8') as file:
file.write(str(driver.page_source))
driver.save_screenshot(filepath + "errorterminauswahl" + timestamp + ".png")
driver.save_screenshot(os.path.join(filepath, "errorterminauswahl" + timestamp + ".png"))
except:
self.log.error("HTML und Screenshot konnten nicht gespeichert werden")
pass
Expand Down Expand Up @@ -524,7 +524,7 @@ def driver_termin_buchen(self, driver, reservierung):
except:
self.log.error("Kontaktdaten können nicht eingegeben werden")
try:
driver.save_screenshot(filepath + "errordateneingeben" + timestamp + ".png")
driver.save_screenshot(os.path.join(filepath, "errordateneingeben" + timestamp + ".png"))
except:
self.log.error("Screenshot konnte nicht gespeichert werden")
pass
Expand Down

0 comments on commit 1ae71fe

Please sign in to comment.