diff --git a/.bazelrc b/.bazelrc index e711429547f5a..aec5d471c6954 100644 --- a/.bazelrc +++ b/.bazelrc @@ -8,11 +8,12 @@ try-import %workspace%/.bazelrc.windows.local # https://github.com/bazelbuild/bazel/issues/20369 # https://github.com/bazelbuild/bazel/issues/21491 -common --lockfile_mode=off +# Required to enable pinned browsers locally. Remove this once we get rid of `$(location)` macros +common --legacy_external_runfiles -# Prepare for Bazel 8. These become the default in 8.0.0 -common --incompatible_disallow_empty_glob -common --incompatible_use_plus_in_repo_names +# Required for rules_closure +common --enable_workspace +common --noincompatible_disallow_struct_provider_syntax # Ensure Windows support is accurate. @@ -44,7 +45,7 @@ build --javacopt="-Xep:ImpossibleNullComparison:OFF" build --nobuild_runfile_links # More JS magic -build --experimental_allow_unresolved_symlinks +build --allow_unresolved_symlinks # Avoid a warning about directory tracking being unsound startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1 @@ -63,8 +64,8 @@ build --incompatible_strict_action_env # Required to get `protobuf` compiling, which is required for `rules_closure` build --incompatible_enable_cc_toolchain_resolution -build --cxxopt=-std=c++14 -build --host_cxxopt=-std=c++14 +build --cxxopt=-std=c++17 +build --host_cxxopt=-std=c++17 # For build stamping @@ -114,7 +115,6 @@ test --test_timeout=1800 test:node_debug --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results test:ruby_debug --test_output=streamed --test_env=RUBY_DEBUG_FORK_MODE=parent --run_under="@bundle//bin:rdbg --nonstop --open --command" - build:release --stamp build:release --compilation_mode=opt diff --git a/.bazelversion b/.bazelversion index 815da58b7a9ed..0e79152459e0e 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.4.1 +8.1.1 diff --git a/.gitignore b/.gitignore index ac79481f1a206..317349226d372 100644 --- a/.gitignore +++ b/.gitignore @@ -133,6 +133,7 @@ MODULE.bazel.lock /.vscode/ /.scannerwork/ /.bazelrc.local +/MODULE.bazel.lock # Engflow *.crt diff --git a/MODULE.bazel b/MODULE.bazel index 4cc7af04c141e..58e974a6a41b7 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -3,8 +3,8 @@ module(name = "selenium") bazel_dep(name = "apple_rules_lint", version = "0.4.0") bazel_dep(name = "aspect_bazel_lib", version = "2.13.0") bazel_dep(name = "aspect_rules_esbuild", version = "0.21.0") -bazel_dep(name = "aspect_rules_js", version = "2.1.3") -bazel_dep(name = "aspect_rules_ts", version = "3.4.0") +bazel_dep(name = "aspect_rules_js", version = "2.3.3") +bazel_dep(name = "aspect_rules_ts", version = "3.5.1") bazel_dep(name = "bazel_features", version = "1.23.0") bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "buildifier_prebuilt", version = "6.4.0") @@ -19,8 +19,8 @@ bazel_dep(name = "rules_cc", version = "0.1.1", dev_dependency = True) bazel_dep(name = "rules_dotnet", version = "0.17.5") bazel_dep(name = "rules_java", version = "8.7.1") -bazel_dep(name = "rules_jvm_external", version = "6.6") -bazel_dep(name = "rules_nodejs", version = "6.3.2") +bazel_dep(name = "rules_jvm_external", version = "6.7") +bazel_dep(name = "rules_nodejs", version = "6.3.4") bazel_dep(name = "rules_oci", version = "1.8.0") bazel_dep(name = "rules_pkg", version = "1.0.1") bazel_dep(name = "rules_python", version = "1.1.0") diff --git a/java/src/org/openqa/selenium/grid/BUILD.bazel b/java/src/org/openqa/selenium/grid/BUILD.bazel index 496ea262d0973..2d08749ecd7b5 100644 --- a/java/src/org/openqa/selenium/grid/BUILD.bazel +++ b/java/src/org/openqa/selenium/grid/BUILD.bazel @@ -34,12 +34,16 @@ java_binary( "//common:linux": [ "@linux_chrome//:chrome-linux64/chrome", "@linux_chromedriver//:chromedriver", + "@linux_edge//:opt/microsoft/msedge/microsoft-edge", + "@linux_edgedriver//:msedgedriver", "@linux_firefox//:firefox/firefox", "@linux_geckodriver//:geckodriver", ], "//common:macos": [ "@mac_chrome//:Chrome.app", "@mac_chromedriver//:chromedriver", + "@mac_edge//:Edge.app", + "@mac_edgedriver//:msedgedriver", "@mac_firefox//:Firefox.app", "@mac_geckodriver//:geckodriver", ], @@ -49,12 +53,16 @@ java_binary( "//common:linux": [ "-Dwebdriver.chrome.driver=$(location @linux_chromedriver//:chromedriver)", "-Dwebdriver.chrome.binary=$(location @linux_chrome//:chrome-linux64/chrome)", + "-Dwebdriver.edge.binary=$(location @linux_edge//:opt/microsoft/msedge/microsoft-edge)", + "-Dwebdriver.edge.driver=$(location @linux_edgedriver//:msedgedriver)", "-Dwebdriver.gecko.driver=$(location @linux_geckodriver//:geckodriver)", "-Dwebdriver.firefox.bin=$(location @linux_firefox//:firefox/firefox)", ], "//common:macos": [ "-Dwebdriver.chrome.driver=$(location @mac_chromedriver//:chromedriver)", "-Dwebdriver.chrome.binary=$(location @mac_chrome//:Chrome.app)/Contents/MacOS/Chrome", + "-Dwebdriver.edge.binary=\"$(location @mac_edge//:Edge.app)/Contents/MacOS/Microsoft Edge\"", + "-Dwebdriver.edge.driver=$(location @mac_edgedriver//:msedgedriver)", "-Dwebdriver.gecko.driver=$(location @mac_geckodriver//:geckodriver)", "-Dwebdriver.firefox.bin=$(location @mac_firefox//:Firefox.app)/Contents/MacOS/firefox", ], diff --git a/javascript/grid-ui/package.json b/javascript/grid-ui/package.json index 7ffbfe6735b51..429c096f978dd 100644 --- a/javascript/grid-ui/package.json +++ b/javascript/grid-ui/package.json @@ -4,11 +4,11 @@ "private": true, "type": "module", "dependencies": { - "@apollo/client": "3.12.6", + "@apollo/client": "3.13.5", "@emotion/react": "11.14.0", "@emotion/styled": "11.14.0", - "@mui/icons-material": "5.15.18", - "@mui/material": "5.15.18", + "@mui/icons-material": "5.17.1", + "@mui/material": "5.17.1", "@novnc/novnc": "1.5.0", "@types/jest": "29.5.14", "@types/node": "20.12.12", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d5db8f2135481..0051bf9f8608f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,8 +11,8 @@ importers: javascript/grid-ui: dependencies: '@apollo/client': - specifier: 3.12.6 - version: 3.12.6(@types/react@18.3.18)(graphql@16.10.0)(react-dom@18.3.1)(react@18.3.1) + specifier: 3.13.5 + version: 3.13.5(@types/react@18.3.18)(graphql@16.10.0)(react-dom@18.3.1)(react@18.3.1) '@emotion/react': specifier: 11.14.0 version: 11.14.0(@types/react@18.3.18)(react@18.3.1) @@ -20,11 +20,11 @@ importers: specifier: 11.14.0 version: 11.14.0(@emotion/react@11.14.0)(@types/react@18.3.18)(react@18.3.1) '@mui/icons-material': - specifier: 5.15.18 - version: 5.15.18(@mui/material@5.15.18)(@types/react@18.3.18)(react@18.3.1) + specifier: 5.17.1 + version: 5.17.1(@mui/material@5.17.1)(@types/react@18.3.18)(react@18.3.1) '@mui/material': - specifier: 5.15.18 - version: 5.15.18(@emotion/react@11.14.0)(@emotion/styled@11.14.0)(@types/react@18.3.18)(react-dom@18.3.1)(react@18.3.1) + specifier: 5.17.1 + version: 5.17.1(@emotion/react@11.14.0)(@emotion/styled@11.14.0)(@types/react@18.3.18)(react-dom@18.3.1)(react@18.3.1) '@novnc/novnc': specifier: 1.5.0 version: 1.5.0 @@ -182,11 +182,11 @@ packages: '@jridgewell/gen-mapping': 0.3.8 '@jridgewell/trace-mapping': 0.3.25 - /@apollo/client@3.12.6(@types/react@18.3.18)(graphql@16.10.0)(react-dom@18.3.1)(react@18.3.1): - resolution: {integrity: sha512-MOEtkojZagMKB7nxlwQ426eaBYwEs/Xfn+JeLOd81wv6j7toKo57eEGAbJdZwyXGRgtiqDkX5gx3EzE7qtarXA==} + /@apollo/client@3.13.5(@types/react@18.3.18)(graphql@16.10.0)(react-dom@18.3.1)(react@18.3.1): + resolution: {integrity: sha512-ceHa1lApLAiGmUur4V+G/CrjwVwHYujfB7U5HM++poCgHpfGn6eet8YGM93fgeWjYX85SaqwdZbQk18IVwhRHg==} peerDependencies: graphql: ^15.0.0 || ^16.0.0 - graphql-ws: ^5.5.5 + graphql-ws: ^5.5.5 || ^6.0.3 react: ^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc subscriptions-transport-ws: ^0.9.0 || ^0.11.0 @@ -212,7 +212,6 @@ packages: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) rehackt: 0.1.0(@types/react@18.3.18)(react@18.3.1) - response-iterator: 0.2.20 symbol-observable: 4.0.0 ts-invariant: 0.10.3 tslib: 2.8.1 @@ -904,34 +903,6 @@ packages: levn: 0.4.1 dev: true - /@floating-ui/core@1.6.9: - resolution: {integrity: sha512-uMXCuQ3BItDUbAMhIXw7UPXRfAlOAvZzdK9BWpE60MCn+Svt3aLn9jsPTi/WNGlRUu2uI0v5S7JiIUsbsvh3fw==} - dependencies: - '@floating-ui/utils': 0.2.9 - dev: false - - /@floating-ui/dom@1.6.13: - resolution: {integrity: sha512-umqzocjDgNRGTuO7Q8CU32dkHkECqI8ZdMZ5Swb6QAM0t5rnlrN3lGo1hdpscRd3WS8T6DKYK4ephgIH9iRh3w==} - dependencies: - '@floating-ui/core': 1.6.9 - '@floating-ui/utils': 0.2.9 - dev: false - - /@floating-ui/react-dom@2.1.2(react-dom@18.3.1)(react@18.3.1): - resolution: {integrity: sha512-06okr5cgPzMNBy+Ycse2A6udMi4bqwW/zgBF/rwjcNqWkyr82Mcg8b0vjX8OJpZFy/FKjJmw6wV7t44kK6kW7A==} - peerDependencies: - react: '>=16.8.0' - react-dom: '>=16.8.0' - dependencies: - '@floating-ui/dom': 1.6.13 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - dev: false - - /@floating-ui/utils@0.2.9: - resolution: {integrity: sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg==} - dev: false - /@graphql-typed-document-node/core@3.2.0(graphql@16.10.0): resolution: {integrity: sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==} peerDependencies: @@ -1062,60 +1033,36 @@ packages: lodash: 4.17.21 dev: true - /@mui/base@5.0.0-beta.40(@types/react@18.3.18)(react-dom@18.3.1)(react@18.3.1): - resolution: {integrity: sha512-I/lGHztkCzvwlXpjD2+SNmvNQvB4227xBXhISPjEaJUXGImOQ9f3D2Yj/T3KasSI/h0MLWy74X0J6clhPmsRbQ==} - engines: {node: '>=12.0.0'} - deprecated: This package has been replaced by @base-ui-components/react - peerDependencies: - '@types/react': ^17.0.0 || ^18.0.0 - react: ^17.0.0 || ^18.0.0 - react-dom: ^17.0.0 || ^18.0.0 - peerDependenciesMeta: - '@types/react': - optional: true - dependencies: - '@babel/runtime': 7.27.0 - '@floating-ui/react-dom': 2.1.2(react-dom@18.3.1)(react@18.3.1) - '@mui/types': 7.4.0(@types/react@18.3.18) - '@mui/utils': 5.17.1(@types/react@18.3.18)(react@18.3.1) - '@popperjs/core': 2.11.8 - '@types/react': 18.3.18 - clsx: 2.1.1 - prop-types: 15.8.1 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - dev: false - /@mui/core-downloads-tracker@5.17.1: resolution: {integrity: sha512-OcZj+cs6EfUD39IoPBOgN61zf1XFVY+imsGoBDwXeSq2UHJZE3N59zzBOVjclck91Ne3e9gudONOeILvHCIhUA==} dev: false - /@mui/icons-material@5.15.18(@mui/material@5.15.18)(@types/react@18.3.18)(react@18.3.1): - resolution: {integrity: sha512-jGhyw02TSLM0NgW+MDQRLLRUD/K4eN9rlK2pTBTL1OtzyZmQ8nB060zK1wA0b7cVrIiG+zyrRmNAvGWXwm2N9Q==} + /@mui/icons-material@5.17.1(@mui/material@5.17.1)(@types/react@18.3.18)(react@18.3.1): + resolution: {integrity: sha512-CN86LocjkunFGG0yPlO4bgqHkNGgaEOEc3X/jG5Bzm401qYw79/SaLrofA7yAKCCXAGdIGnLoMHohc3+ubs95A==} engines: {node: '>=12.0.0'} peerDependencies: '@mui/material': ^5.0.0 - '@types/react': ^17.0.0 || ^18.0.0 - react: ^17.0.0 || ^18.0.0 + '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0 + react: ^17.0.0 || ^18.0.0 || ^19.0.0 peerDependenciesMeta: '@types/react': optional: true dependencies: '@babel/runtime': 7.27.0 - '@mui/material': 5.15.18(@emotion/react@11.14.0)(@emotion/styled@11.14.0)(@types/react@18.3.18)(react-dom@18.3.1)(react@18.3.1) + '@mui/material': 5.17.1(@emotion/react@11.14.0)(@emotion/styled@11.14.0)(@types/react@18.3.18)(react-dom@18.3.1)(react@18.3.1) '@types/react': 18.3.18 react: 18.3.1 dev: false - /@mui/material@5.15.18(@emotion/react@11.14.0)(@emotion/styled@11.14.0)(@types/react@18.3.18)(react-dom@18.3.1)(react@18.3.1): - resolution: {integrity: sha512-n+/dsiqux74fFfcRUJjok+ieNQ7+BEk6/OwX9cLcLvriZrZb+/7Y8+Fd2HlUUbn5N0CDurgAHm0VH1DqyJ9HAw==} + /@mui/material@5.17.1(@emotion/react@11.14.0)(@emotion/styled@11.14.0)(@types/react@18.3.18)(react-dom@18.3.1)(react@18.3.1): + resolution: {integrity: sha512-2B33kQf+GmPnrvXXweWAx+crbiUEsxCdCN979QDYnlH9ox4pd+0/IBriWLV+l6ORoBF60w39cWjFnJYGFdzXcw==} engines: {node: '>=12.0.0'} peerDependencies: '@emotion/react': ^11.5.0 '@emotion/styled': ^11.3.0 - '@types/react': ^17.0.0 || ^18.0.0 - react: ^17.0.0 || ^18.0.0 - react-dom: ^17.0.0 || ^18.0.0 + '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0 + react: ^17.0.0 || ^18.0.0 || ^19.0.0 + react-dom: ^17.0.0 || ^18.0.0 || ^19.0.0 peerDependenciesMeta: '@emotion/react': optional: true @@ -1127,11 +1074,11 @@ packages: '@babel/runtime': 7.27.0 '@emotion/react': 11.14.0(@types/react@18.3.18)(react@18.3.1) '@emotion/styled': 11.14.0(@emotion/react@11.14.0)(@types/react@18.3.18)(react@18.3.1) - '@mui/base': 5.0.0-beta.40(@types/react@18.3.18)(react-dom@18.3.1)(react@18.3.1) '@mui/core-downloads-tracker': 5.17.1 '@mui/system': 5.17.1(@emotion/react@11.14.0)(@emotion/styled@11.14.0)(@types/react@18.3.18)(react@18.3.1) - '@mui/types': 7.4.0(@types/react@18.3.18) + '@mui/types': 7.2.24(@types/react@18.3.18) '@mui/utils': 5.17.1(@types/react@18.3.18)(react@18.3.1) + '@popperjs/core': 2.11.8 '@types/react': 18.3.18 '@types/react-transition-group': 4.4.12(@types/react@18.3.18) clsx: 2.1.1 @@ -1139,7 +1086,7 @@ packages: prop-types: 15.8.1 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - react-is: 18.3.1 + react-is: 19.1.0 react-transition-group: 4.4.5(react-dom@18.3.1)(react@18.3.1) dev: false @@ -1223,18 +1170,6 @@ packages: '@types/react': 18.3.18 dev: false - /@mui/types@7.4.0(@types/react@18.3.18): - resolution: {integrity: sha512-TxJ4ezEeedWHBjOmLtxI203a9DII9l4k83RXmz1PYSAmnyEcK2PglTNmJGxswC/wM5cdl9ap2h8lnXvt2swAGQ==} - peerDependencies: - '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0 - peerDependenciesMeta: - '@types/react': - optional: true - dependencies: - '@babel/runtime': 7.27.0 - '@types/react': 18.3.18 - dev: false - /@mui/utils@5.17.1(@types/react@18.3.18)(react@18.3.1): resolution: {integrity: sha512-jEZ8FTqInt2WzxDV8bhImWBqeQRD99c/id/fq83H0ER9tFl+sfZlaAoCdznGvbSQQ9ividMxqSV2c7cC1vBcQg==} engines: {node: '>=12.0.0'} @@ -5202,11 +5137,6 @@ packages: supports-preserve-symlinks-flag: 1.0.0 dev: true - /response-iterator@0.2.20: - resolution: {integrity: sha512-RfNi9saiJ9VKznrRZEGZtlfeiQI7NWMUlXvmkvO60xaHfW1y+36EOibZkV59LuKNak8VIqL6IyxYxhMOGTurIQ==} - engines: {node: '>=0.8'} - dev: false - /reusify@1.1.0: resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} diff --git a/py/BUILD.bazel b/py/BUILD.bazel index 578b746bb69b1..8ae21c99c7f12 100644 --- a/py/BUILD.bazel +++ b/py/BUILD.bazel @@ -72,6 +72,7 @@ BROWSER_VERSIONS = [ TEST_DEPS = [ requirement("attrs"), + requirement("bazel_runfiles"), requirement("debugpy"), requirement("filetype"), requirement("idna"), diff --git a/py/conftest.py b/py/conftest.py index a16c83b3e0226..876ccfaf0a0e5 100644 --- a/py/conftest.py +++ b/py/conftest.py @@ -25,6 +25,7 @@ from urllib.request import urlopen import pytest +from runfiles import Runfiles from selenium import webdriver @@ -191,6 +192,16 @@ def get_options(driver_class, config): bidi = bool(config.option.bidi) options = None + # Check to see if the `browser_path` exists + if browser_path: + if not os.path.exists(browser_path): + # Maybe it's hiding in the runfiles + r = Runfiles.Create() + rlocation_path = r.Rlocation(browser_path) + if not os.path.exists(rlocation_path): + raise Exception("Unable to find browser at " + browser_path) + browser_path = rlocation_path + if browser_path or browser_args: if not options: options = getattr(webdriver, f"{driver_class}Options")() @@ -226,6 +237,14 @@ def get_service(driver_class, executable): if not executable: return None + # Make sure the executable exists + if not os.path.exists(executable): + r = Runfiles.Create() + rlocation_path = r.Rlocation(executable) + if not os.path.exists(rlocation_path): + raise Exception("Unable to find driver executable: " + executable) + executable = rlocation_path + module = getattr(webdriver, driver_class.lower()) service = module.service.Service(executable_path=executable) diff --git a/py/private/browsers.bzl b/py/private/browsers.bzl index 01a0a01694172..60cb32e9ce9d4 100644 --- a/py/private/browsers.bzl +++ b/py/private/browsers.bzl @@ -15,40 +15,40 @@ headless_args = select({ chrome_args = select({ "@selenium//common:use_pinned_linux_chrome": [ - "--driver-binary=$(location @linux_chromedriver//:chromedriver)", - "--browser-binary=$(location @linux_chrome//:chrome-linux64/chrome)", + "--driver-binary=$(rlocationpath @linux_chromedriver//:chromedriver)", + "--browser-binary=$(rlocationpath @linux_chrome//:chrome-linux64/chrome)", "--browser-args=--disable-dev-shm-usage", "--browser-args=--no-sandbox", ], "@selenium//common:use_pinned_macos_chrome": [ - "--driver-binary=$(location @mac_chromedriver//:chromedriver)", - "--browser-binary=$(location @mac_chrome//:Chrome.app)/Contents/MacOS/Chrome", + "--driver-binary=$(rlocationpath @mac_chromedriver//:chromedriver)", + "--browser-binary=$(rlocationpath @mac_chrome//:Chrome.app)/Contents/MacOS/Chrome", ], "//conditions:default": [], }) + headless_args edge_args = select({ "@selenium//common:use_pinned_linux_edge": [ - "--driver-binary=$(location @linux_edgedriver//:msedgedriver)", - "--browser-binary=$(location @linux_edge//:opt/microsoft/msedge/microsoft-edge)", + "--driver-binary=$(rlocationpath @linux_edgedriver//:msedgedriver)", + "--browser-binary=$(rlocationpath @linux_edge//:opt/microsoft/msedge/microsoft-edge)", "--browser-args=--disable-dev-shm-usage", "--browser-args=--no-sandbox", ], "@selenium//common:use_pinned_macos_edge": [ - "--driver-binary=$(location @mac_edgedriver//:msedgedriver)", - "--browser-binary='$(location @mac_edge//:Edge.app)/Contents/MacOS/Microsoft Edge'", + "--driver-binary=$(rlocationpath @mac_edgedriver//:msedgedriver)", + "--browser-binary='$(rlocationpath @mac_edge//:Edge.app)/Contents/MacOS/Microsoft Edge'", ], "//conditions:default": [], }) + headless_args firefox_args = select({ "@selenium//common:use_pinned_linux_firefox": [ - "--driver-binary=$(location @linux_geckodriver//:geckodriver)", - "--browser-binary=$(location @linux_firefox//:firefox/firefox)", + "--driver-binary=$(rlocationpath @linux_geckodriver//:geckodriver)", + "--browser-binary=$(rlocationpath @linux_firefox//:firefox/firefox)", ], "@selenium//common:use_pinned_macos_firefox": [ - "--driver-binary=$(location @mac_geckodriver//:geckodriver)", - "--browser-binary=$(location @mac_firefox//:Firefox.app)/Contents/MacOS/firefox", + "--driver-binary=$(rlocationpath @mac_geckodriver//:geckodriver)", + "--browser-binary=$(rlocationpath @mac_firefox//:Firefox.app)/Contents/MacOS/firefox", ], "//conditions:default": [], }) + headless_args diff --git a/py/requirements.txt b/py/requirements.txt index aef1b0f79400f..d7e4444e65f0e 100644 --- a/py/requirements.txt +++ b/py/requirements.txt @@ -1,5 +1,6 @@ async-generator==1.10 attrs==23.2.0 +bazel_runfiles==1.2.0 certifi==2023.11.17 cffi==1.16.0 cryptography==42.0.8 diff --git a/py/requirements_lock.txt b/py/requirements_lock.txt index 7dbcc69434f70..2f716d35db694 100644 --- a/py/requirements_lock.txt +++ b/py/requirements_lock.txt @@ -18,6 +18,9 @@ attrs==23.2.0 \ # -r py/requirements.txt # outcome # trio +bazel-runfiles==1.2.0 \ + --hash=sha256:08cb0c7e43c260fa5b1a6ab88ddba79d0e6f85c365483bf26aab74713bbdb2df + # via -r py/requirements.txt certifi==2023.11.17 \ --hash=sha256:9b469f3a900bf28dc19b8cfbf8019bf47f7fdd1a65a1d4ffb98fc14166beb4d1 \ --hash=sha256:e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474 @@ -288,9 +291,7 @@ jaraco-classes==3.3.0 \ jeepney==0.8.0 \ --hash=sha256:5efe48d255973902f6badc3ce55e2aa6c5c3b3bc642059ef3a91247bcfcc5806 \ --hash=sha256:c0a454ad016ca575060802ee4d590dd912e35c122fa04e70306de3d076cce755 - # via - # keyring - # secretstorage + # via secretstorage keyring==24.3.0 \ --hash=sha256:4446d35d636e6a10b8bce7caa66913dd9eca5fd222ca03a3d42c38608ac30836 \ --hash=sha256:e730ecffd309658a08ee82535a3b5ec4b4c8669a9be11efb66249d8e0aeb9a25 @@ -518,9 +519,7 @@ rich==13.7.0 \ secretstorage==3.3.3 \ --hash=sha256:2403533ef369eca6d2ba81718576c5e0f564d5cca1b58f73a8b23e7d4eeebd77 \ --hash=sha256:f356e6628222568e3af06f2eba8df495efa13b3b63081dafd4f7d9a7b7bc9f99 - # via - # -r py/requirements.txt - # keyring + # via -r py/requirements.txt sniffio==1.3.1 \ --hash=sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2 \ --hash=sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc diff --git a/rb/lib/selenium/server.rb b/rb/lib/selenium/server.rb index ef2b05e99f199..1c96110098c1e 100644 --- a/rb/lib/selenium/server.rb +++ b/rb/lib/selenium/server.rb @@ -240,9 +240,14 @@ def stop_process def process @process ||= begin # extract any additional_args that start with -D as options - properties = @additional_args.dup - @additional_args.delete_if { |arg| arg[/^-D/] } - args = ['-jar', @jar, @role, '--port', @port.to_s] - server_command = [@java] + properties + args + @additional_args + properties = @additional_args.dup - @additional_args.delete_if { |arg| arg[/^(--jvm_flag=)?-D/] } + server_command = if @jar.end_with?('.jar') + [@java, *properties, '-jar', @jar] + else + [@jar, *properties] + end + args = [@role, '--port', @port.to_s] + server_command += args + @additional_args cp = WebDriver::ChildProcess.build(*server_command) if @log.is_a?(String) diff --git a/rb/spec/BUILD.bazel b/rb/spec/BUILD.bazel index 11e51dd89c3e4..4467f4110a020 100644 --- a/rb/spec/BUILD.bazel +++ b/rb/spec/BUILD.bazel @@ -22,10 +22,12 @@ rb_library( "//rb/spec/integration/selenium/webdriver:driver", "//rb/spec/integration/selenium/webdriver:element", "//rb/spec/integration/selenium/webdriver:error", + "//rb/spec/integration/selenium/webdriver:fedcm", "//rb/spec/integration/selenium/webdriver:guard", "//rb/spec/integration/selenium/webdriver:listener", "//rb/spec/integration/selenium/webdriver:manager", "//rb/spec/integration/selenium/webdriver:navigation", + "//rb/spec/integration/selenium/webdriver:network", "//rb/spec/integration/selenium/webdriver:select", "//rb/spec/integration/selenium/webdriver:shadow_root", "//rb/spec/integration/selenium/webdriver:spec_helper", @@ -53,6 +55,7 @@ rb_library( "//rb/spec/integration/selenium/webdriver/remote:driver", "//rb/spec/integration/selenium/webdriver/remote:element", "//rb/spec/integration/selenium/webdriver/safari:driver", + "//rb/spec/integration/selenium/webdriver/safari:service", "//rb/spec/unit/selenium:devtools", "//rb/spec/unit/selenium:server", "//rb/spec/unit/selenium/devtools:cdp_client_generator", @@ -109,6 +112,7 @@ rb_library( "//rb/spec/unit/selenium/webdriver/remote:capabilities", "//rb/spec/unit/selenium/webdriver/remote:driver", "//rb/spec/unit/selenium/webdriver/remote/http:common", + "//rb/spec/unit/selenium/webdriver/remote/http:curb", "//rb/spec/unit/selenium/webdriver/remote/http:default", "//rb/spec/unit/selenium/webdriver/safari:driver", "//rb/spec/unit/selenium/webdriver/safari:options", @@ -118,12 +122,3 @@ rb_library( "//rb/spec/unit/selenium/webdriver/support:select", ], ) - -genrule( - name = "java-location", - srcs = [], - outs = ["java-location.txt"], - cmd = "echo $(JAVA) > $@", - toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"], - visibility = ["//rb/spec:__subpackages__"], -) diff --git a/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb b/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb index 517a10ce1e909..9e7efe9a41814 100644 --- a/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb +++ b/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb @@ -89,18 +89,17 @@ def app_server def remote_server args = if ENV.key?('CHROMEDRIVER_BINARY') - ["-Dwebdriver.chrome.driver=#{ENV['CHROMEDRIVER_BINARY']}"] + ["--jvm_flag=-Dwebdriver.chrome.driver=#{ENV['CHROMEDRIVER_BINARY']}"] elsif ENV.key?('MSEDGEDRIVER_BINARY') - ["-Dwebdriver.edge.driver=#{ENV['MSEDGEDRIVER_BINARY']}"] + ["--jvm_flag=-Dwebdriver.edge.driver=#{ENV['MSEDGEDRIVER_BINARY']}"] elsif ENV.key?('GECKODRIVER_BINARY') - ["-Dwebdriver.gecko.driver=#{ENV['GECKODRIVER_BINARY']}"] + ["--jvm_flag=-Dwebdriver.gecko.driver=#{ENV['GECKODRIVER_BINARY']}"] else %w[--selenium-manager true --enable-managed-downloads true] end @remote_server ||= Selenium::Server.new( remote_server_jar, - java: bazel_java, port: random_port, log_level: WebDriver.logger.debug? && 'FINE', background: true, @@ -109,12 +108,6 @@ def remote_server ) end - def bazel_java - return unless ENV.key?('WD_BAZEL_JAVA_LOCATION') - - File.expand_path(File.read(File.expand_path(ENV.fetch('WD_BAZEL_JAVA_LOCATION'))).chomp) - end - def rbe? Dir.pwd.start_with?('/mnt/engflow') end @@ -130,6 +123,8 @@ def remote_server? end def remote_server_jar + return ENV['WD_BAZEL_SERVER_LOCATION'] if ENV.key?('WD_BAZEL_SERVER_LOCATION') + jar = 'java/src/org/openqa/selenium/grid/selenium_server_deploy.jar' test_jar = Pathname.new(Dir.pwd).join(jar) built_jar = root.join("bazel-bin/#{jar}") diff --git a/rb/spec/tests.bzl b/rb/spec/tests.bzl index 7004d184b2494..bc28d3fbf37ab 100644 --- a/rb/spec/tests.bzl +++ b/rb/spec/tests.bzl @@ -19,12 +19,12 @@ BROWSERS = { "WD_SPEC_DRIVER": "chrome", } | select({ "@selenium//common:use_pinned_linux_chrome": { - "CHROME_BINARY": "$(location @linux_chrome//:chrome-linux64/chrome)", - "CHROMEDRIVER_BINARY": "$(location @linux_chromedriver//:chromedriver)", + "CHROME_BINARY": "$(rootpath @linux_chrome//:chrome-linux64/chrome)", + "CHROMEDRIVER_BINARY": "$(rootpath @linux_chromedriver//:chromedriver)", }, "@selenium//common:use_pinned_macos_chrome": { - "CHROME_BINARY": "$(location @mac_chrome//:Chrome.app)/Contents/MacOS/Chrome", - "CHROMEDRIVER_BINARY": "$(location @mac_chromedriver//:chromedriver)", + "CHROME_BINARY": "$(rootpath @mac_chrome//:Chrome.app)/Contents/MacOS/Chrome", + "CHROMEDRIVER_BINARY": "$(rootpath @mac_chromedriver//:chromedriver)", }, "//conditions:default": {}, }) | select({ @@ -42,12 +42,12 @@ BROWSERS = { "WD_SPEC_DRIVER": "edge", } | select({ "@selenium//common:use_pinned_linux_edge": { - "EDGE_BINARY": "$(location @linux_edge//:opt/microsoft/msedge/microsoft-edge)", - "MSEDGEDRIVER_BINARY": "$(location @linux_edgedriver//:msedgedriver)", + "EDGE_BINARY": "$(rootpath @linux_edge//:opt/microsoft/msedge/microsoft-edge)", + "MSEDGEDRIVER_BINARY": "$(rootpath @linux_edgedriver//:msedgedriver)", }, "@selenium//common:use_pinned_macos_edge": { - "EDGE_BINARY": "$(location @mac_edge//:Edge.app)/Contents/MacOS/Microsoft\\ Edge", - "MSEDGEDRIVER_BINARY": "$(location @mac_edgedriver//:msedgedriver)", + "EDGE_BINARY": "$(rootpath @mac_edge//:Edge.app)/Contents/MacOS/Microsoft\\ Edge", + "MSEDGEDRIVER_BINARY": "$(rootpath @mac_edgedriver//:msedgedriver)", }, "//conditions:default": {}, }) | select({ @@ -65,12 +65,12 @@ BROWSERS = { "WD_SPEC_DRIVER": "firefox", } | select({ "@selenium//common:use_pinned_linux_firefox": { - "FIREFOX_BINARY": "$(location @linux_firefox//:firefox/firefox)", - "GECKODRIVER_BINARY": "$(location @linux_geckodriver//:geckodriver)", + "FIREFOX_BINARY": "$(rootpath @linux_firefox//:firefox/firefox)", + "GECKODRIVER_BINARY": "$(rootpath @linux_geckodriver//:geckodriver)", }, "@selenium//common:use_pinned_macos_firefox": { - "FIREFOX_BINARY": "$(location @mac_firefox//:Firefox.app)/Contents/MacOS/firefox", - "GECKODRIVER_BINARY": "$(location @mac_geckodriver//:geckodriver)", + "FIREFOX_BINARY": "$(rootpath @mac_firefox//:Firefox.app)/Contents/MacOS/firefox", + "GECKODRIVER_BINARY": "$(rootpath @mac_geckodriver//:geckodriver)", }, "//conditions:default": {}, }) | select({ @@ -88,12 +88,12 @@ BROWSERS = { "WD_SPEC_DRIVER": "firefox", } | select({ "@selenium//common:use_pinned_linux_firefox": { - "FIREFOX_BINARY": "$(location @linux_beta_firefox//:firefox/firefox)", - "GECKODRIVER_BINARY": "$(location @linux_geckodriver//:geckodriver)", + "FIREFOX_BINARY": "$(rootpath @linux_beta_firefox//:firefox/firefox)", + "GECKODRIVER_BINARY": "$(rootpath @linux_geckodriver//:geckodriver)", }, "@selenium//common:use_pinned_macos_firefox": { - "FIREFOX_BINARY": "$(location @mac_beta_firefox//:Firefox.app)/Contents/MacOS/firefox", - "GECKODRIVER_BINARY": "$(location @mac_geckodriver//:geckodriver)", + "FIREFOX_BINARY": "$(rootpath @mac_beta_firefox//:Firefox.app)/Contents/MacOS/firefox", + "GECKODRIVER_BINARY": "$(rootpath @mac_geckodriver//:geckodriver)", }, "//conditions:default": {}, }) | select({ @@ -173,13 +173,11 @@ def rb_integration_test(name, srcs, deps = [], data = [], browsers = BROWSERS.ke args = ["rb/spec/"], data = BROWSERS[browser]["data"] + data + [ "//common/src/web", - "//java/src/org/openqa/selenium/grid:selenium_server_deploy.jar", - "//rb/spec:java-location", - "@bazel_tools//tools/jdk:current_java_runtime", + "//java/src/org/openqa/selenium/grid:selenium_server", ], env = BROWSERS[browser]["env"] | { - "WD_BAZEL_JAVA_LOCATION": "$(rootpath //rb/spec:java-location)", "WD_SPEC_DRIVER": "remote", + "WD_BAZEL_SERVER_LOCATION": "$(rootpath //java/src/org/openqa/selenium/grid:selenium_server)", }, main = "@bundle//bin:rspec", tags = COMMON_TAGS + BROWSERS[browser]["tags"] + tags + ["{}-remote".format(browser)],