Skip to content

Commit

Permalink
[py] use Selenium Manager in tests with bazel when pinned browsers no…
Browse files Browse the repository at this point in the history
…t set

This can be overridden by specifying --driver-binary in addopts in pytest.ini
  • Loading branch information
titusfortner committed Jan 6, 2024
1 parent d77b568 commit 34adf3e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
4 changes: 2 additions & 2 deletions py/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def pytest_ignore_collect(path, config):
def driver(request):
kwargs = {}

# browser can be changed with `--driver=firefox` as an argument or in pytest.ini
driver_class = request.param.capitalize() if request.param else "Chrome"
# browser can be changed with `--driver=firefox` as an argument or to addopts in pytest.ini
driver_class = getattr(request, 'param', 'Chrome').capitalize()

# skip tests if not available on the platform
_platform = platform.system()
Expand Down
9 changes: 0 additions & 9 deletions py/private/browsers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ chrome_args = select({
"--driver-binary=$(location @mac_chromedriver//:chromedriver)",
"--browser-binary=$(location @mac_chrome//:Chrome.app)/Contents/MacOS/Chrome",
],
"@selenium//common:use_local_chromedriver": [
"--driver-binary=$(location @selenium//common:chromedriver)",
],
"//conditions:default": [],
}) + headless_args

Expand All @@ -35,9 +32,6 @@ edge_args = select({
"--driver-binary=$(location @mac_edgedriver//:msedgedriver)",
"--browser-binary='$(location @mac_edge//:Edge.app)/Contents/MacOS/Microsoft Edge'",
],
"@selenium//common:use_local_msedgedriver": [
"--driver-binary=$(location @selenium//common:msedgedriver)",
],
"//conditions:default": [],
}) + headless_args

Expand All @@ -50,9 +44,6 @@ firefox_args = select({
"--driver-binary=$(location @mac_geckodriver//:geckodriver)",
"--browser-binary=$(location @mac_firefox//:Firefox.app)/Contents/MacOS/firefox",
],
"@selenium//common:use_local_geckodriver": [
"--driver-binary=$(location @selenium//common:geckodriver)",
],
"//conditions:default": [],
}) + headless_args

Expand Down

0 comments on commit 34adf3e

Please sign in to comment.