You've already forked SeleniumHQ.selenium.py
[py] fix black and flake8 linting issues
NOKEYCHECK=True GitOrigin-RevId: db507155fd42156a504ec9ca4eda374b7f903ee0
This commit is contained in:

committed by
Copybara-Service

parent
af29d81a20
commit
5cf5cde409
@@ -137,9 +137,7 @@ def driver(request):
|
|||||||
if driver_class == "Chrome":
|
if driver_class == "Chrome":
|
||||||
options = get_options(driver_class, request.config)
|
options = get_options(driver_class, request.config)
|
||||||
if driver_class == "Remote":
|
if driver_class == "Remote":
|
||||||
options = (
|
options = get_options("Firefox", request.config) or webdriver.FirefoxOptions()
|
||||||
get_options("Firefox", request.config) or webdriver.FirefoxOptions()
|
|
||||||
)
|
|
||||||
options.set_capability("moz:firefoxOptions", {})
|
options.set_capability("moz:firefoxOptions", {})
|
||||||
options.enable_downloads = True
|
options.enable_downloads = True
|
||||||
if driver_class == "WebKitGTK":
|
if driver_class == "WebKitGTK":
|
||||||
@@ -282,9 +280,7 @@ def server(request):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
print(f"Selenium server running as process: {process.pid}")
|
print(f"Selenium server running as process: {process.pid}")
|
||||||
assert wait_for_server(
|
assert wait_for_server(url, 10), f"Timed out waiting for Selenium server at {url}"
|
||||||
url, 10
|
|
||||||
), f"Timed out waiting for Selenium server at {url}"
|
|
||||||
print("Selenium server is ready")
|
print("Selenium server is ready")
|
||||||
yield process
|
yield process
|
||||||
process.terminate()
|
process.terminate()
|
||||||
|
@@ -41,8 +41,6 @@ class DriverFinder:
|
|||||||
raise NoSuchDriverException(msg) from err
|
raise NoSuchDriverException(msg) from err
|
||||||
|
|
||||||
if path is None or not Path(path).is_file():
|
if path is None or not Path(path).is_file():
|
||||||
raise NoSuchDriverException(
|
raise NoSuchDriverException(f"Unable to locate or obtain driver for {options.capabilities['browserName']}")
|
||||||
f"Unable to locate or obtain driver for {options.capabilities['browserName']}"
|
|
||||||
)
|
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
@@ -112,9 +112,7 @@ class Service(ABC):
|
|||||||
"""Check if the underlying process is still running."""
|
"""Check if the underlying process is still running."""
|
||||||
return_code = self.process.poll()
|
return_code = self.process.poll()
|
||||||
if return_code:
|
if return_code:
|
||||||
raise WebDriverException(
|
raise WebDriverException(f"Service {self._path} unexpectedly exited. Status code was: {return_code}")
|
||||||
f"Service {self._path} unexpectedly exited. Status code was: {return_code}"
|
|
||||||
)
|
|
||||||
|
|
||||||
def is_connectable(self) -> bool:
|
def is_connectable(self) -> bool:
|
||||||
"""Establishes a socket connection to determine if the service running
|
"""Establishes a socket connection to determine if the service running
|
||||||
@@ -204,9 +202,7 @@ class Service(ABC):
|
|||||||
start_info = None
|
start_info = None
|
||||||
if system() == "Windows":
|
if system() == "Windows":
|
||||||
start_info = subprocess.STARTUPINFO()
|
start_info = subprocess.STARTUPINFO()
|
||||||
start_info.dwFlags = (
|
start_info.dwFlags = subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW
|
||||||
subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW
|
|
||||||
)
|
|
||||||
start_info.wShowWindow = subprocess.SW_HIDE
|
start_info.wShowWindow = subprocess.SW_HIDE
|
||||||
|
|
||||||
self.process = subprocess.Popen(
|
self.process = subprocess.Popen(
|
||||||
|
@@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.no_driver_after_test
|
@pytest.mark.no_driver_after_test
|
||||||
def test_launch_and_close_browser(clean_driver, clean_service):
|
def test_launch_and_close_browser(clean_driver, clean_service):
|
||||||
|
@@ -21,7 +21,6 @@ import time
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from selenium.common.exceptions import WebDriverException
|
from selenium.common.exceptions import WebDriverException
|
||||||
from selenium.webdriver import Chrome
|
|
||||||
from selenium.webdriver.chrome.service import Service
|
from selenium.webdriver.chrome.service import Service
|
||||||
|
|
||||||
|
|
||||||
|
@@ -21,8 +21,6 @@ import pytest
|
|||||||
|
|
||||||
from selenium.common.exceptions import WebDriverException
|
from selenium.common.exceptions import WebDriverException
|
||||||
from selenium.webdriver.chrome.options import Options
|
from selenium.webdriver.chrome.options import Options
|
||||||
from selenium.webdriver.chrome.service import Service
|
|
||||||
from selenium.webdriver.common.driver_finder import DriverFinder
|
|
||||||
from selenium.webdriver.common.proxy import Proxy
|
from selenium.webdriver.common.proxy import Proxy
|
||||||
from selenium.webdriver.common.selenium_manager import SeleniumManager
|
from selenium.webdriver.common.selenium_manager import SeleniumManager
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user