Closed titusfortner closed 3 weeks ago
โฑ๏ธ Estimated effort to review [1-5] | 3, because the changes involve significant architectural modifications including the introduction of a new class and refactoring of existing methods. Understanding the impact of these changes on the overall system requires a good grasp of the existing architecture and the new requirements. |
๐งช Relevant tests | No |
โก Possible issues | Possible Bug: The `create_session` method in `BiDiBridge` assumes that `@capabilities[:web_socket_url]` is always present and valid. If it's not provided or incorrect, it could lead to runtime errors. |
Error Handling: The `quit` and `close` methods in `BiDiBridge` call `bidi.close` without checking if `bidi` has been successfully initialized (i.e., not nil). This could potentially lead to a `NoMethodError` if `create_session` fails or does not set `@bidi`. | |
๐ Security concerns | No |
Category | Suggestion | Score |
Possible issue |
Add a check to ensure the presence of the
___
**Consider adding a check to ensure that | 8 |
Add a check to ensure
___
**Add a check to ensure | 8 | |
Add a safe navigation operator to prevent potential
___
**Add a check to ensure | 7 | |
Maintainability |
Remove the redundant
___
**Remove the redundant | 6 |
**Action:** Ruby / Remote Tests (edge, windows) / Remote Tests (edge, windows) |
**Failed stage:** [Run Bazel](https://github.com/SeleniumHQ/selenium/actions/runs/9402899887/job/25901202558) [โ] |
**Failure summary:**
The action failed because the protoc.exe command encountered an error during the generation of the proto_library for the target @io_bazel_rules_closure//java/io/bazel/rules/closure:build_info_proto . Exit -1073741819 .tests were skipped. |
Relevant error logs:```yaml 1: ##[group]Operating System 2: Microsoft Windows Server 2022 ... 619: [32m[1 / 1][0m checking cached actions 620: [32mAnalyzing:[0m 28 targets (680 packages loaded, 11617 targets configured) 621: [32m[1 / 1][0m checking cached actions 622: [32mAnalyzing:[0m 28 targets (680 packages loaded, 38612 targets configured) 623: [32m[1 / 1][0m checking cached actions 624: [32mAnalyzing:[0m 28 targets (685 packages loaded, 40121 targets configured) 625: [32m[1 / 1][0m checking cached actions 626: [32mAnalyzing:[0m 28 targets (685 packages loaded, 40151 targets configured) 627: [32m[1 / 17][0m [Prepa] Writing repo mapping manifest for //rb/spec/integration/selenium/webdriver:error-edge-remote ... 736: [32m[1,992 / 3,109][0m Compiling src/google/protobuf/compiler/command_line_interface.cc [for tool]; 6s local, disk-cache ... (3 actions, 1 running) 737: [32m[2,081 / 3,109][0m Compiling src/google/protobuf/compiler/command_line_interface.cc [for tool]; 7s local, disk-cache ... (3 actions, 1 running) 738: [32mINFO: [0mFrom Building external/protobuf~/java/core/liblite_runtime_only.jar (91 source files) [for tool]: 739: external\protobuf~\java\core\src\main\java\com\google\protobuf\UnsafeUtil.java:293: warning: [removal] AccessController in java.security has been deprecated and marked for removal 740: AccessController.doPrivileged( 741: ^ 742: [32m[2,182 / 3,109][0m Compiling src/google/protobuf/compiler/command_line_interface.cc [for tool]; 8s local, disk-cache ... (3 actions, 1 running) 743: [32mINFO: [0mFrom Building java/src/org/openqa/selenium/remote/libapi-class.jar (66 source files): 744: java\src\org\openqa\selenium\remote\ErrorHandler.java:46: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 745: private final ErrorCodes errorCodes; 746: ^ 747: java\src\org\openqa\selenium\remote\ErrorHandler.java:60: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 748: this.errorCodes = new ErrorCodes(); 749: ^ 750: java\src\org\openqa\selenium\remote\ErrorHandler.java:68: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 751: public ErrorHandler(ErrorCodes codes, boolean includeServerErrors) { 752: ^ 753: java\src\org\openqa\selenium\remote\Response.java:97: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 754: ErrorCodes errorCodes = new ErrorCodes(); 755: ^ 756: java\src\org\openqa\selenium\remote\Response.java:97: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 757: ErrorCodes errorCodes = new ErrorCodes(); 758: ^ 759: java\src\org\openqa\selenium\remote\ProtocolHandshake.java:181: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 760: response.setStatus(ErrorCodes.SUCCESS); 761: ^ 762: java\src\org\openqa\selenium\remote\ProtocolHandshake.java:182: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 763: response.setState(ErrorCodes.SUCCESS_STRING); 764: ^ 765: java\src\org\openqa\selenium\remote\W3CHandshakeResponse.java:53: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 766: new ErrorCodes().toStatus((String) rawError, Optional.of(tuple.getStatusCode()))); 767: ^ 768: java\src\org\openqa\selenium\remote\W3CHandshakeResponse.java:56: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 769: new ErrorCodes().getExceptionType((String) rawError); 770: ^ 771: java\src\org\openqa\selenium\remote\codec\AbstractHttpResponseCodec.java:44: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 772: private final ErrorCodes errorCodes = new ErrorCodes(); 773: ^ 774: java\src\org\openqa\selenium\remote\codec\AbstractHttpResponseCodec.java:44: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 775: private final ErrorCodes errorCodes = new ErrorCodes(); 776: ^ 777: java\src\org\openqa\selenium\remote\codec\AbstractHttpResponseCodec.java:55: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 778: int status = response.getStatus() == ErrorCodes.SUCCESS ? HTTP_OK : HTTP_INTERNAL_ERROR; 779: ^ 780: java\src\org\openqa\selenium\remote\codec\AbstractHttpResponseCodec.java:101: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 781: response.setStatus(ErrorCodes.UNKNOWN_COMMAND); 782: ^ 783: java\src\org\openqa\selenium\remote\codec\AbstractHttpResponseCodec.java:103: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 784: response.setStatus(ErrorCodes.UNHANDLED_ERROR); 785: ^ 786: java\src\org\openqa\selenium\remote\codec\AbstractHttpResponseCodec.java:124: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 787: response.setStatus(ErrorCodes.SUCCESS); 788: ^ 789: java\src\org\openqa\selenium\remote\codec\AbstractHttpResponseCodec.java:125: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 790: response.setState(errorCodes.toState(ErrorCodes.SUCCESS)); 791: ^ 792: java\src\org\openqa\selenium\remote\codec\AbstractHttpResponseCodec.java:131: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 793: response.setState(errorCodes.toState(ErrorCodes.SUCCESS)); 794: ^ 795: java\src\org\openqa\selenium\remote\codec\w3c\W3CHttpResponseCodec.java:70: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 796: private final ErrorCodes errorCodes = new ErrorCodes(); 797: ^ 798: java\src\org\openqa\selenium\remote\codec\w3c\W3CHttpResponseCodec.java:70: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 799: private final ErrorCodes errorCodes = new ErrorCodes(); 800: ^ 801: java\src\org\openqa\selenium\remote\codec\w3c\W3CHttpResponseCodec.java:93: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 802: response.setStatus(ErrorCodes.UNKNOWN_COMMAND); 803: ^ 804: java\src\org\openqa\selenium\remote\codec\w3c\W3CHttpResponseCodec.java:98: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 805: response.setStatus(ErrorCodes.UNHANDLED_ERROR); 806: ^ 807: java\src\org\openqa\selenium\remote\codec\w3c\W3CHttpResponseCodec.java:145: warning: [removal] ErrorCodes in org.openqa.selenium.remote has been deprecated and marked for removal 808: response.setStatus(ErrorCodes.SUCCESS); ... 813: C:\Users\RUNNER~1\AppData\Local\Temp\Bazel.runfiles_pue6bkac\runfiles\rules_python~~python~python_3_8_x86_64-pc-windows-msvc\lib\zipfile.py:1517: UserWarning: Duplicate name: 'grid-ui/' 814: return self._open_to_write(zinfo, force_zip64=force_zip64) 815: [32m[2,200 / 3,109][0m Installing external/rules_ruby~~ruby~bundle/rb/vendor/cache/bundler-2.5.10.gem (@bundle//:bundler-2.5.10); 2s local, disk-cache ... (4 actions, 2 running) 816: [32mINFO: [0mFrom Installing external/rules_ruby~~ruby~bundle/rb/vendor/cache/bundler-2.5.10.gem (@@rules_ruby~~ruby~bundle//:bundler-2.5.10): 817: Successfully installed bundler-2.5.10 818: 1 gem installed 819: [32m[2,201 / 3,109][0m Linking external/protobuf~/protoc.exe [for tool]; 1s local, disk-cache ... (4 actions, 2 running) 820: [32m[2,202 / 3,109][0m RunBinary rb/lib/selenium/devtools/v124.rb; 2s disk-cache ... (4 actions, 2 running) 821: [31m[1mERROR: [0mD:/_bazel/external/io_bazel_rules_closure/java/io/bazel/rules/closure/BUILD:64:14: Generating proto_library @@io_bazel_rules_closure//java/io/bazel/rules/closure:build_info_proto [for tool] failed: (Exit -1073741819): protoc.exe failed: error executing GenProto command (from target @@io_bazel_rules_closure//java/io/bazel/rules/closure:build_info_proto) 822: cd /d D:/_bazel/execroot/_main 823: SET PATH=C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Windows;C:\Windows\System32;C:\Windows\System32\WindowsPowerShell\v1.0 824: bazel-out\x64_windows-opt-exec-ST-13d3ddad9198\bin\external\protobuf~\protoc.exe --java_out=bazel-out/x64_windows-opt-exec-ST-13d3ddad9198/bin/external/io_bazel_rules_closure/java/io/bazel/rules/closure/build_info_proto-speed-src.jar -Iexternal/io_bazel_rules_closure -I. external/io_bazel_rules_closure/java/io/bazel/rules/closure/build_info.proto 825: # Configuration: 3f62d58e1724b33c4c5a838ec5dd37be29e6f58351fe7900d780cb5e8258345c 826: # Execution platform: @@local_config_platform//:host 827: [32m[2,206 / 3,109][0m 1 / 28 tests, [31m[1m1 failed[0m;[0m checking cached actions 828: [32mINFO: [0mElapsed time: 300.395s, Critical Path: 18.44s 829: [32mINFO: [0m1968 processes: 558 disk cache hit, 1227 internal, 183 local. 830: [31m[1mERROR: [0mBuild did NOT complete successfully 831: //rb/spec/integration/selenium/webdriver:action_builder-edge-remote [0m[31m[1mNO STATUS[0m 832: //rb/spec/integration/selenium/webdriver:bidi-edge-remote [0m[31m[1mNO STATUS[0m 833: //rb/spec/integration/selenium/webdriver:devtools-edge-remote [0m[31m[1mNO STATUS[0m 834: //rb/spec/integration/selenium/webdriver:driver-edge-remote [0m[31m[1mNO STATUS[0m 835: //rb/spec/integration/selenium/webdriver:element-edge-remote [0m[31m[1mNO STATUS[0m 836: //rb/spec/integration/selenium/webdriver:error-edge-remote [0m[31m[1mNO STATUS[0m ... 850: //rb/spec/integration/selenium/webdriver/bidi:log_inspector-edge-remote [0m[31m[1mNO STATUS[0m 851: //rb/spec/integration/selenium/webdriver/bidi:script-edge-remote [0m[31m[1mNO STATUS[0m 852: //rb/spec/integration/selenium/webdriver/edge:driver-edge-remote [0m[31m[1mNO STATUS[0m 853: //rb/spec/integration/selenium/webdriver/edge:options-edge-remote [0m[31m[1mNO STATUS[0m 854: //rb/spec/integration/selenium/webdriver/edge:profile-edge-remote [0m[31m[1mNO STATUS[0m 855: //rb/spec/integration/selenium/webdriver/edge:service-edge-remote [0m[31m[1mNO STATUS[0m 856: //rb/spec/integration/selenium/webdriver/remote:driver-edge-remote [0m[31m[1mNO STATUS[0m 857: //rb/spec/integration/selenium/webdriver/remote:element-edge-remote [0m[31m[1mNO STATUS[0m 858: //rb/spec/integration/selenium/webdriver:virtual_authenticator-edge-remote [0m[31m[1mFAILED TO BUILD[0m 859: Executed 0 out of 28 tests: [0m[31m[1m1 fails to build[0m and [0m[35m27 were skipped[0m. 860: [0m 861: ##[error]Process completed with exit code 1. ``` |
These test failures are weird protoc compile issues that don't make sense and definitely don't impact this PR (and intermittently pass on rerun ๐คท). The RBE tests are passing is the important piece.
User description
This is a much simpler implementation of, and replaces #13126
Description
"webSocketUrl": true
to the driver should give the right failure message if it is not supported, bindings don't have to work around it#bidi
onBridge
gives a warning that web_socket_url must be used to access BiDi (this is the real reason to pass the bridge to the BiDi classes and not just the bidi instance; the warning is in one place and works everywhere)Motivation and Context
This is a prerequisite for #13995
PR Type
Enhancement
Description
BiDiBridge
class to handle BiDi-specific logic.create_bridge
method to useBiDiBridge
whenwebSocketUrl
capability is true.BiDiBridge
in the remote module.Bridge
class to remove BiDi-specific logic and updated thebidi
method to raise an error ifweb_socket_url
is not enabled.Changes walkthrough ๐
driver.rb
Use `BiDiBridge` subclass based on `webSocketUrl` capability
rb/lib/selenium/webdriver/common/driver.rb
create_bridge
method to useBiDiBridge
subclass whenwebSocketUrl
is true.remote.rb
Autoload `BiDiBridge` in remote module
rb/lib/selenium/webdriver/remote.rb - Added autoload for `BiDiBridge`.
bidi_bridge.rb
Implement `BiDiBridge` class with session management
rb/lib/selenium/webdriver/remote/bidi_bridge.rb
BiDiBridge
class inheriting fromBridge
.create_session
,quit
, andclose
methods inBiDiBridge
.bridge.rb
Refactor `Bridge` class to remove BiDi logic
rb/lib/selenium/webdriver/remote/bridge.rb
Bridge
class.bidi
method to raise an error ifweb_socket_url
is notenabled.