Skip to content

Commit

Permalink
feat: add default driver height
Browse files Browse the repository at this point in the history
  • Loading branch information
adeprez committed Oct 4, 2024
1 parent 8a10f7e commit 38d7e3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@ def __init__(
log_waiting_time=False,
user_agent="Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
auto_init=True,
width: int = 1096,
height: int = 1096,
) -> None:
self.waiting_completion_timeout = waiting_completion_timeout
self.log_waiting_time = log_waiting_time
self.width = width
self.height = height
if options:
self.options = options
else:
Expand All @@ -75,6 +79,7 @@ def __init__(

def init(self) -> None:
self.driver = Chrome(options=self.options)
self.resize_driver(self.width, self.height)
self.driver.execute_cdp_cmd(
"Page.addScriptToEvaluateOnNewDocument",
{"source": JS_SETUP_GET_EVENTS},
Expand Down
2 changes: 1 addition & 1 deletion lavague-sdk/lavague/sdk/base_driver/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,5 +290,5 @@ def __exit__(self, *_):
self.driver_ready = False

def __del__(self):
if self.driver_ready:
if getattr(self, "driver_ready", False):
self.__exit__()

0 comments on commit 38d7e3f

Please sign in to comment.