Skip to content

Commit

Permalink
Added Service option
Browse files Browse the repository at this point in the history
  • Loading branch information
dhuynh-lovable committed Oct 7, 2024
1 parent 0aa6d2c commit 4a310a4
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.support.ui import WebDriverWait

from selenium.webdriver.chrome.service import Service

class SeleniumDriver(BaseDriver[SeleniumNode]):
driver: WebDriver

def __init__(
self,
options: Optional[Options] = None,
service: Optional[Service] = None,
headless: bool = True,
user_data_dir: Optional[str] = None,
waiting_completion_timeout=10,
Expand Down Expand Up @@ -74,11 +75,12 @@ def __init__(
self.options.add_argument("--disable-web-security")
self.options.add_argument("--disable-site-isolation-trials")
self.options.set_capability("goog:loggingPrefs", {"performance": "ALL"})
self.service = service
if auto_init:
self.init()

def init(self) -> None:
self.driver = Chrome(options=self.options)
self.driver = Chrome(options=self.options, service=self.service)
self.resize_driver(self.width, self.height)
self.driver.execute_cdp_cmd(
"Page.addScriptToEvaluateOnNewDocument",
Expand Down

0 comments on commit 4a310a4

Please sign in to comment.