Skip to content

Commit

Permalink
update web_selenium.py to use try-with for headers (Significant-Gravi…
Browse files Browse the repository at this point in the history
…tas#2988)

Co-authored-by: Richard Beales <[email protected]>
  • Loading branch information
non-adj and richbeales authored May 1, 2023
1 parent 94ec4a4 commit 7fc6f2a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion autogpt/commands/web_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,9 @@ def add_header(driver: WebDriver) -> None:
Returns:
None
"""
driver.execute_script(open(f"{FILE_DIR}/js/overlay.js", "r").read())
try:
with open(f"{FILE_DIR}/js/overlay.js", "r") as overlay_file:
overlay_script = overlay_file.read()
driver.execute_script(overlay_script)
except Exception as e:
print(f"Error executing overlay.js: {e}")

0 comments on commit 7fc6f2a

Please sign in to comment.