chore: add type hints

This commit is contained in:
gnought 2023-11-15 09:41:03 +08:00
parent bc7797f401
commit 4ab229b58d
No known key found for this signature in database
GPG Key ID: 04D7C0864CCDDF10
1 changed files with 4 additions and 3 deletions

View File

@ -33,6 +33,7 @@ from selenium.common.exceptions import (
)
from selenium.webdriver import chrome, firefox, FirefoxProfile
from selenium.webdriver.common.by import By
from selenium.webdriver.common.service import Service
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
@ -254,8 +255,8 @@ class WebDriverSelenium(WebDriverProxy):
def create(self) -> WebDriver:
pixel_density = current_app.config["WEBDRIVER_WINDOW"].get("pixel_density", 1)
if self._driver_type == "firefox":
driver_class = firefox.webdriver.WebDriver
service_class = firefox.service.Service
driver_class: type[WebDriver] = firefox.webdriver.WebDriver
service_class: type[Service] = firefox.service.Service
options = firefox.options.Options()
profile = FirefoxProfile()
profile.set_preference("layout.css.devPixelsPerPx", str(pixel_density))
@ -274,7 +275,7 @@ class WebDriverSelenium(WebDriverProxy):
)
# Prepare args for the webdriver init
for arg in current_app.config["WEBDRIVER_OPTION_ARGS"]:
for arg in list(current_app.config["WEBDRIVER_OPTION_ARGS"]):
options.add_argument(arg)
# Add additional configured webdriver options