Skip to content

Commit

Permalink
EES-4444 Use webdriver-manager for Chromedriver downloads
Browse files Browse the repository at this point in the history
This replaces Pyderman, which currently doesn't support Chrome 115+
due to recent changes in how Chrome versions are published.

See:
- SergeyPirogov/webdriver_manager#580
- shadowmoose/pyderman#35
  • Loading branch information
ntsim committed Aug 19, 2023
1 parent 2b0973d commit d59c8df
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 73 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ robotframework-seleniumlibrary = "~=6.1.0"
requests = "~=2.31.0"
python-dotenv = "~=1.0.0"
robotframework-pabot = "~=2.16.0"
pyderman = "~=3.3.2"
pytz = "~=2023.3"
beautifulsoup4 = "~=4.12.2"
robotframework-tidy = "~=4.4.0"
Expand All @@ -24,6 +23,7 @@ flake8 = "~=6.1.0"
isort = "~=5.12.0"
black = "~=23.7.0"
cffi = "~=1.15.1"
webdriver-manager = "~=4.0.0"

[requires]
python_version = "3.10"
116 changes: 61 additions & 55 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/robot-tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
os.environ["EXPIRED_INVITE_USER_PASSWORD"] = args.expiredinvite_pass

# Install chromedriver and add it to PATH
get_webdriver(args.chromedriver_version or "latest")
get_webdriver(args.chromedriver_version or None)

output_file = "rerun.xml" if args.rerun_failed_tests or args.rerun_failed_suites else "output.xml"

Expand Down
2 changes: 1 addition & 1 deletion tests/robot-tests/scripts/create_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def write_snapshots_to_file(self) -> None:
if not args.visual:
chrome_options.add_argument("--headless")

get_webdriver("latest")
get_webdriver()

driver = webdriver.Chrome(options=chrome_options)

Expand Down
2 changes: 1 addition & 1 deletion tests/robot-tests/scripts/get_auth_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def get_identity_info(
using_existing_driver = driver is not None

if not driver:
get_webdriver("latest")
get_webdriver()

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--no-sandbox")
Expand Down
21 changes: 7 additions & 14 deletions tests/robot-tests/scripts/get_webdriver.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
import os
import platform
from pathlib import Path
from typing import Optional

import pyderman
from webdriver_manager.chrome import ChromeDriverManager


def get_webdriver(version: str) -> None:
chromedriver_filename = "chromedriver.exe" if platform.system() == "Windows" else "chromedriver"
pyderman.install(
file_directory="./webdriver/",
filename=chromedriver_filename,
verbose=True,
chmod=True,
overwrite=False,
version=version,
)
def get_webdriver(version: Optional[str] = None) -> None:
driver_path = ChromeDriverManager(driver_version=version).install()
driver_dir = Path(driver_path).parents[0]

os.environ["PATH"] += os.pathsep + str(Path("./webdriver").absolute())
os.environ["PATH"] += os.pathsep + str(driver_dir)


if __name__ == "__main__":
get_webdriver("latest")
get_webdriver()

0 comments on commit d59c8df

Please sign in to comment.