Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rb] implement navigation commands with BiDi #14094

Merged
merged 8 commits into from
Nov 20, 2024
Merged

[rb] implement navigation commands with BiDi #14094

merged 8 commits into from
Nov 20, 2024

Conversation

titusfortner
Copy link
Member

@titusfortner titusfortner commented Jun 6, 2024

User description

Description

  • creates context manager class, constructed with bridge instance
  • pulls page load strategy from capabilities and uses in required methods
  • we eventually want to figure out how to store current browsing context as state on the bridge (I think)? For now this always gets the current window handle first
  • deprecates BrowsingContext

Considerations

  • navigate and reload return NavigateResult objects; should I return it as a Struct or just ignore it since we aren't doing anything with it and not promising a return value?
  • Should these BiDi classes be marked private api?
  • I want to implement this as BrowsingContext instead of creating a new class and deprecating that one; do we need to be backwards compatible with this since we didn't mark it private api?

Motivation and Context

Ruby implementation of #13995


PR Type

Enhancement, Tests


Description

  • Added ContextManager class to handle navigation commands using BiDi.
  • Deprecated BrowsingContext class in favor of ContextManager.
  • Enhanced BiDiBridge with new navigation methods: get, go_back, go_forward, and refresh.
  • Added integration tests for navigation methods.

Changes walkthrough 📝

Relevant files
Enhancement
bidi.rb
Add `ContextManager` to autoload list in BiDi module         

rb/lib/selenium/webdriver/bidi.rb

  • Added ContextManager to autoload list.
+1/-0     
browsing_context.rb
Deprecate `BrowsingContext` class in favor of `ContextManager`

rb/lib/selenium/webdriver/bidi/browsing_context.rb

  • Added deprecation warning for BrowsingContext class.
+4/-0     
context_manager.rb
Implement `ContextManager` class with navigation methods 

rb/lib/selenium/webdriver/bidi/context_manager.rb

  • Created ContextManager class.
  • Implemented navigation methods: navigate, traverse_history, and
    reload.
  • +59/-0   
    bidi_bridge.rb
    Add navigation methods and `context_manager` to `BiDiBridge`

    rb/lib/selenium/webdriver/remote/bidi_bridge.rb

  • Added navigation methods: get, go_back, go_forward, and refresh.
  • Introduced private context_manager method.
  • +22/-0   
    Tests
    navigation_spec.rb
    Add integration tests for navigation methods                         

    rb/spec/integration/selenium/webdriver/navigation_spec.rb

    • Added tests for navigation methods: back, forward, and refresh.
    +33/-30 

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Copy link
    Contributor

    PR Review 🔍

    ⏱️ Estimated effort to review [1-5]

    3, because the PR introduces a new class ContextManager and deprecates an existing one, BrowsingContext. It also modifies navigation methods in BiDiBridge and adds integration tests. The changes are moderate in size and involve understanding the new navigation logic and its integration with the existing system.

    🧪 Relevant tests

    Yes

    ⚡ Possible issues

    Possible Bug: The navigate, traverse_history, and reload methods in ContextManager assume that @bridge.window_handle will always provide a valid context ID. This might not be the case if the window has been closed or not initialized properly.

    Deprecation Concern: The deprecation of BrowsingContext needs a clear migration path and thorough documentation to ensure that existing users can transition smoothly without breaking their implementations.

    🔒 Security concerns

    No

    Copy link
    Contributor

    codiumai-pr-agent-pro bot commented Jun 6, 2024

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Add a default value for @readiness to handle cases where page_load_strategy is not present

    The @readiness instance variable is being set based on the page_load_strategy from
    bridge.capabilities. It would be prudent to handle cases where page_load_strategy might
    not be present in the capabilities, to avoid potential nil errors.

    rb/lib/selenium/webdriver/bidi/context_manager.rb [36-37]

     page_load_strategy = bridge.capabilities[:page_load_strategy]
    -@readiness = READINESS_STATE[page_load_strategy]
    +@readiness = READINESS_STATE.fetch(page_load_strategy, 'complete')
     
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: This suggestion correctly identifies a potential issue where page_load_strategy might be missing, which could lead to a nil error. Adding a default value is a crucial improvement for robustness.

    8
    Validation
    Add URL validation to the navigate method to ensure the provided URL is valid

    The navigate method sends a command to navigate to a URL. It would be beneficial to
    validate the url parameter to ensure it is a valid URL before sending the command, to
    prevent potential errors.

    rb/lib/selenium/webdriver/bidi/context_manager.rb [40-43]

    +require 'uri'
    +
     def navigate(url, context_id: nil)
    +  raise ArgumentError, 'Invalid URL' unless url =~ URI::DEFAULT_PARSER.make_regexp
    +
       context_id ||= @bridge.window_handle
       @bidi.send_cmd('browsingContext.navigate', context: context_id, url: url, wait: @readiness)
     end
     
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Validating the URL before navigating helps prevent errors from invalid URLs, which is a good practice for robustness, though not as critical as handling potential nil errors.

    7
    Thread safety
    Use a mutex to ensure thread safety when initializing @context_manager

    The context_manager method initializes a new ContextManager instance if it doesn't already
    exist. To ensure thread safety, consider using a mutex to avoid potential race conditions
    when initializing @context_manager.

    rb/lib/selenium/webdriver/remote/bidi_bridge.rb [60-62]

     def context_manager
    -  @context_manager ||= WebDriver::BiDi::ContextManager.new(self)
    +  @context_manager_mutex ||= Mutex.new
    +  @context_manager_mutex.synchronize do
    +    @context_manager ||= WebDriver::BiDi::ContextManager.new(self)
    +  end
     end
     
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Ensuring thread safety with a mutex is a good practice, especially in a multi-threaded environment, to avoid race conditions during the initialization of shared resources.

    7
    Testing
    Add assertions to verify the navigate, back, and forward methods are called the expected number of times

    The navigation tests could benefit from adding assertions to verify that the navigate,
    back, forward, and refresh methods are called the expected number of times, ensuring the
    methods are invoked correctly.

    rb/spec/integration/selenium/webdriver/navigation_spec.rb [30-46]

    +expect(driver.navigate).to receive(:to).with(form_url).once
     driver.navigate.to form_url
     expect(driver.title).to eq(form_title)
     
     driver.find_element(id: 'imageButton').click
     wait.until { driver.title != form_title }
     
     expect(driver.current_url).to include(result_url)
     expect(driver.title).to eq(result_title)
     
    +expect(driver.navigate).to receive(:back).once
     driver.navigate.back
     
     expect(driver.current_url).to include(form_url)
     expect(driver.title).to eq(form_title)
     
    +expect(driver.navigate).to receive(:forward).once
     driver.navigate.forward
     expect(driver.current_url).to include(result_url)
     expect(driver.title).to eq(result_title)
     
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: Adding assertions for method calls enhances the test's ability to verify correct behavior, although it's more about refining tests than fixing a critical issue.

    6

    Copy link
    Contributor

    codiumai-pr-agent-pro bot commented Jun 6, 2024

    CI Failure Feedback 🧐

    (Checks updated until commit a863363)

    Action: Ruby / Local Tests (chrome, windows) / Local Tests (chrome, windows)

    Failed stage: Run Bazel [❌]

    Failed test name: Selenium::WebDriver::Chrome::Driver PrintsPage

    Failure summary:

    The action failed due to three test failures in the Selenium::WebDriver::Chrome::Driver PrintsPage
    suite:

  • returns base64 for print command: This test failed because of a
    Selenium::WebDriver::Error::TimeoutError, indicating a timeout while receiving a message from the
    renderer.
  • prints with valid params: This test also failed due to a Selenium::WebDriver::Error::TimeoutError,
    with the same timeout issue from the renderer.
  • saves pdf: This test encountered a Selenium::WebDriver::Error::TimeoutError, again due to a timeout
    while receiving a message from the renderer.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Microsoft Windows Server 2022
    ...
    
    720:  �[32m[1,883 / 1,900]�[0m 8 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:navigation-chrome; 21s disk-cache ... (4 actions, 2 running)
    721:  �[32m[1,884 / 1,900]�[0m 9 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:navigation-chrome; 22s disk-cache ... (4 actions, 1 running)
    722:  �[32m[1,884 / 1,900]�[0m 9 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver/chrome:profile-chrome; 21s disk-cache ... (4 actions, 1 running)
    723:  �[32m[1,884 / 1,900]�[0m 9 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:select-chrome; 11s local, disk-cache ... (4 actions, 1 running)
    724:  �[32m[1,884 / 1,900]�[0m 9 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:select-chrome; 13s local, disk-cache ... (4 actions, 1 running)
    725:  �[32m[1,884 / 1,900]�[0m 9 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:select-chrome; 14s local, disk-cache ... (4 actions, 2 running)
    726:  �[32m[1,885 / 1,900]�[0m 10 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:listener-chrome; 14s disk-cache ... (4 actions, 1 running)
    727:  �[32m[1,885 / 1,900]�[0m 10 / 31 tests;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver/chrome:profile-chrome; 7s ... (4 actions, 1 running)
    728:  �[32m[1,886 / 1,900]�[0m 11 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:error-chrome; 5s disk-cache ... (4 actions, 1 running)
    729:  �[32m[1,886 / 1,900]�[0m 11 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:error-chrome; 9s disk-cache ... (4 actions, 2 running)
    730:  �[32m[1,887 / 1,900]�[0m 12 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:error-chrome; 10s disk-cache ... (4 actions, 1 running)
    731:  �[32m[1,887 / 1,900]�[0m 12 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:error-chrome; 16s disk-cache ... (4 actions, 1 running)
    732:  �[32m[1,888 / 1,900]�[0m 13 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:error-chrome; 17s disk-cache ... (4 actions, 0 running)
    ...
    
    782:  �[32m[1,898 / 1,900]�[0m 23 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver/chrome:driver-chrome; 300s local, disk-cache ... (2 actions running)
    783:  �[32m[1,898 / 1,900]�[0m 23 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver/chrome:driver-chrome; 305s local, disk-cache ... (2 actions running)
    784:  �[32m[1,899 / 1,900]�[0m 24 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver/chrome:driver-chrome; 306s local, disk-cache
    785:  �[32m[1,899 / 1,900]�[0m 24 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver/chrome:driver-chrome; 316s local, disk-cache
    786:  �[32m[1,899 / 1,900]�[0m 24 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver/chrome:driver-chrome; 346s local, disk-cache
    787:  �[32m[1,899 / 1,900]�[0m 24 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver/chrome:driver-chrome; 406s local, disk-cache
    788:  �[32m[1,899 / 1,900]�[0m 24 / 31 tests;�[0m Testing //rb/spec/integration/selenium/webdriver/chrome:driver-chrome; 436s local, disk-cache
    789:  �[31m�[1mFAIL: �[0m//rb/spec/integration/selenium/webdriver/chrome:driver-chrome (see D:/_bazel/execroot/_main/bazel-out/x64_windows-fastbuild/testlogs/rb/spec/integration/selenium/webdriver/chrome/driver-chrome/test.log)
    790:  �[31m�[1mFAILED: �[0m//rb/spec/integration/selenium/webdriver/chrome:driver-chrome (Summary)
    ...
    
    805:  gets and sets network conditions
    806:  sets download path
    807:  can execute CDP commands
    808:  manages network features
    809:  casts
    810:  can set single permissions
    811:  can set multiple permissions
    812:  PrintsPage
    813:  returns base64 for print command (FAILED - 1)
    814:  prints with valid params (FAILED - 2)
    815:  saves pdf (FAILED - 3)
    816:  #logs
    817:  can fetch available log types
    818:  can get the browser log
    819:  can get the driver log
    820:  can get the performance log
    821:  Failures:
    822:  1) Selenium::WebDriver::Chrome::Driver PrintsPage returns base64 for print command
    823:  Failure/Error: expect(driver.print_page).to include(magic_number)
    824:  Selenium::WebDriver::Error::TimeoutError:
    825:  timeout: Timed out receiving message from renderer: 10.000
    826:  (Session info: chrome=131.0.6778.85)
    827:  # ./rb/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
    828:  # ./rb/lib/selenium/webdriver/remote/response.rb:41:in `error'
    ...
    
    833:  # ./rb/lib/selenium/webdriver/remote/http/default.rb:103:in `request'
    834:  # ./rb/lib/selenium/webdriver/remote/http/common.rb:68:in `call'
    835:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:685:in `execute'
    836:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:421:in `print_page'
    837:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:54:in `print_page'
    838:  # ./rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb:67:in `block (3 levels) in <module:Chrome>'
    839:  # ------------------
    840:  # --- Caused by: ---
    841:  # Selenium::WebDriver::Error::WebDriverError:
    ...
    
    859:  GetHandleVerifier [0x00007FF6C979BDBB+835995]
    860:  (No symbol) [0x00007FF6C964EB5F]
    861:  (No symbol) [0x00007FF6C964A814]
    862:  (No symbol) [0x00007FF6C964A9AD]
    863:  (No symbol) [0x00007FF6C963A199]
    864:  BaseThreadInitThunk [0x00007FF99D7B4CB0+16]
    865:  RtlUserThreadStart [0x00007FF99E75ECDB+43]
    866:  2) Selenium::WebDriver::Chrome::Driver PrintsPage prints with valid params
    867:  Failure/Error:
    868:  expect(driver.print_page(orientation: 'landscape',
    869:  page_ranges: ['1-2'],
    870:  page: {width: 30})).to include(magic_number)
    871:  Selenium::WebDriver::Error::TimeoutError:
    872:  timeout: Timed out receiving message from renderer: 10.000
    873:  (Session info: chrome=131.0.6778.85)
    874:  # ./rb/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
    875:  # ./rb/lib/selenium/webdriver/remote/response.rb:41:in `error'
    ...
    
    880:  # ./rb/lib/selenium/webdriver/remote/http/default.rb:103:in `request'
    881:  # ./rb/lib/selenium/webdriver/remote/http/common.rb:68:in `call'
    882:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:685:in `execute'
    883:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:421:in `print_page'
    884:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:54:in `print_page'
    885:  # ./rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb:72:in `block (3 levels) in <module:Chrome>'
    886:  # ------------------
    887:  # --- Caused by: ---
    888:  # Selenium::WebDriver::Error::WebDriverError:
    ...
    
    906:  GetHandleVerifier [0x00007FF6C979BDBB+835995]
    907:  (No symbol) [0x00007FF6C964EB5F]
    908:  (No symbol) [0x00007FF6C964A814]
    909:  (No symbol) [0x00007FF6C964A9AD]
    910:  (No symbol) [0x00007FF6C963A199]
    911:  BaseThreadInitThunk [0x00007FF99D7B4CB0+16]
    912:  RtlUserThreadStart [0x00007FF99E75ECDB+43]
    913:  3) Selenium::WebDriver::Chrome::Driver PrintsPage saves pdf
    914:  Failure/Error: driver.save_print_page path
    915:  Selenium::WebDriver::Error::TimeoutError:
    916:  timeout: Timed out receiving message from renderer: 10.000
    917:  (Session info: chrome=131.0.6778.85)
    918:  # ./rb/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
    919:  # ./rb/lib/selenium/webdriver/remote/response.rb:41:in `error'
    ...
    
    927:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:421:in `print_page'
    928:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:54:in `print_page'
    929:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:37:in `block in save_print_page'
    930:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:36:in `open'
    931:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:36:in `save_print_page'
    932:  # ./rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb:82:in `block (3 levels) in <module:Chrome>'
    933:  # ------------------
    934:  # --- Caused by: ---
    935:  # Selenium::WebDriver::Error::WebDriverError:
    ...
    
    953:  GetHandleVerifier [0x00007FF6C979BDBB+835995]
    954:  (No symbol) [0x00007FF6C964EB5F]
    955:  (No symbol) [0x00007FF6C964A814]
    956:  (No symbol) [0x00007FF6C964A9AD]
    957:  (No symbol) [0x00007FF6C963A199]
    958:  BaseThreadInitThunk [0x00007FF99D7B4CB0+16]
    959:  RtlUserThreadStart [0x00007FF99E75ECDB+43]
    960:  Finished in 2 minutes 8.5 seconds (files took 1.05 seconds to load)
    961:  14 examples, 3 failures
    962:  Failed examples:
    ...
    
    977:  gets and sets network conditions
    978:  sets download path
    979:  can execute CDP commands
    980:  manages network features
    981:  casts
    982:  can set single permissions
    983:  can set multiple permissions
    984:  PrintsPage
    985:  returns base64 for print command (FAILED - 1)
    986:  prints with valid params (FAILED - 2)
    987:  saves pdf (FAILED - 3)
    988:  #logs
    989:  can fetch available log types
    990:  can get the browser log
    991:  can get the driver log
    992:  can get the performance log
    993:  Failures:
    994:  1) Selenium::WebDriver::Chrome::Driver PrintsPage returns base64 for print command
    995:  Failure/Error: expect(driver.print_page).to include(magic_number)
    996:  Selenium::WebDriver::Error::TimeoutError:
    997:  timeout: Timed out receiving message from renderer: 10.000
    998:  (Session info: chrome=131.0.6778.85)
    999:  # ./rb/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
    1000:  # ./rb/lib/selenium/webdriver/remote/response.rb:41:in `error'
    ...
    
    1005:  # ./rb/lib/selenium/webdriver/remote/http/default.rb:103:in `request'
    1006:  # ./rb/lib/selenium/webdriver/remote/http/common.rb:68:in `call'
    1007:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:685:in `execute'
    1008:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:421:in `print_page'
    1009:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:54:in `print_page'
    1010:  # ./rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb:67:in `block (3 levels) in <module:Chrome>'
    1011:  # ------------------
    1012:  # --- Caused by: ---
    1013:  # Selenium::WebDriver::Error::WebDriverError:
    ...
    
    1031:  GetHandleVerifier [0x00007FF6C979BDBB+835995]
    1032:  (No symbol) [0x00007FF6C964EB5F]
    1033:  (No symbol) [0x00007FF6C964A814]
    1034:  (No symbol) [0x00007FF6C964A9AD]
    1035:  (No symbol) [0x00007FF6C963A199]
    1036:  BaseThreadInitThunk [0x00007FF99D7B4CB0+16]
    1037:  RtlUserThreadStart [0x00007FF99E75ECDB+43]
    1038:  2) Selenium::WebDriver::Chrome::Driver PrintsPage prints with valid params
    1039:  Failure/Error:
    1040:  expect(driver.print_page(orientation: 'landscape',
    1041:  page_ranges: ['1-2'],
    1042:  page: {width: 30})).to include(magic_number)
    1043:  Selenium::WebDriver::Error::TimeoutError:
    1044:  timeout: Timed out receiving message from renderer: 10.000
    1045:  (Session info: chrome=131.0.6778.85)
    1046:  # ./rb/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
    1047:  # ./rb/lib/selenium/webdriver/remote/response.rb:41:in `error'
    ...
    
    1052:  # ./rb/lib/selenium/webdriver/remote/http/default.rb:103:in `request'
    1053:  # ./rb/lib/selenium/webdriver/remote/http/common.rb:68:in `call'
    1054:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:685:in `execute'
    1055:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:421:in `print_page'
    1056:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:54:in `print_page'
    1057:  # ./rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb:72:in `block (3 levels) in <module:Chrome>'
    1058:  # ------------------
    1059:  # --- Caused by: ---
    1060:  # Selenium::WebDriver::Error::WebDriverError:
    ...
    
    1078:  GetHandleVerifier [0x00007FF6C979BDBB+835995]
    1079:  (No symbol) [0x00007FF6C964EB5F]
    1080:  (No symbol) [0x00007FF6C964A814]
    1081:  (No symbol) [0x00007FF6C964A9AD]
    1082:  (No symbol) [0x00007FF6C963A199]
    1083:  BaseThreadInitThunk [0x00007FF99D7B4CB0+16]
    1084:  RtlUserThreadStart [0x00007FF99E75ECDB+43]
    1085:  3) Selenium::WebDriver::Chrome::Driver PrintsPage saves pdf
    1086:  Failure/Error: driver.save_print_page path
    1087:  Selenium::WebDriver::Error::TimeoutError:
    1088:  timeout: Timed out receiving message from renderer: 10.000
    1089:  (Session info: chrome=131.0.6778.85)
    1090:  # ./rb/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
    1091:  # ./rb/lib/selenium/webdriver/remote/response.rb:41:in `error'
    ...
    
    1099:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:421:in `print_page'
    1100:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:54:in `print_page'
    1101:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:37:in `block in save_print_page'
    1102:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:36:in `open'
    1103:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:36:in `save_print_page'
    1104:  # ./rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb:82:in `block (3 levels) in <module:Chrome>'
    1105:  # ------------------
    1106:  # --- Caused by: ---
    1107:  # Selenium::WebDriver::Error::WebDriverError:
    ...
    
    1125:  GetHandleVerifier [0x00007FF6C979BDBB+835995]
    1126:  (No symbol) [0x00007FF6C964EB5F]
    1127:  (No symbol) [0x00007FF6C964A814]
    1128:  (No symbol) [0x00007FF6C964A9AD]
    1129:  (No symbol) [0x00007FF6C963A199]
    1130:  BaseThreadInitThunk [0x00007FF99D7B4CB0+16]
    1131:  RtlUserThreadStart [0x00007FF99E75ECDB+43]
    1132:  Finished in 2 minutes 8.5 seconds (files took 0.93698 seconds to load)
    1133:  14 examples, 3 failures
    1134:  Failed examples:
    ...
    
    1149:  gets and sets network conditions
    1150:  sets download path
    1151:  can execute CDP commands
    1152:  manages network features
    1153:  casts
    1154:  can set single permissions
    1155:  can set multiple permissions
    1156:  PrintsPage
    1157:  returns base64 for print command (FAILED - 1)
    1158:  prints with valid params (FAILED - 2)
    1159:  saves pdf (FAILED - 3)
    1160:  #logs
    1161:  can fetch available log types
    1162:  can get the browser log
    1163:  can get the driver log
    1164:  can get the performance log
    1165:  Failures:
    1166:  1) Selenium::WebDriver::Chrome::Driver PrintsPage returns base64 for print command
    1167:  Failure/Error: expect(driver.print_page).to include(magic_number)
    1168:  Selenium::WebDriver::Error::TimeoutError:
    1169:  timeout: Timed out receiving message from renderer: 10.000
    1170:  (Session info: chrome=131.0.6778.85)
    1171:  # ./rb/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
    1172:  # ./rb/lib/selenium/webdriver/remote/response.rb:41:in `error'
    ...
    
    1177:  # ./rb/lib/selenium/webdriver/remote/http/default.rb:103:in `request'
    1178:  # ./rb/lib/selenium/webdriver/remote/http/common.rb:68:in `call'
    1179:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:685:in `execute'
    1180:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:421:in `print_page'
    1181:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:54:in `print_page'
    1182:  # ./rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb:67:in `block (3 levels) in <module:Chrome>'
    1183:  # ------------------
    1184:  # --- Caused by: ---
    1185:  # Selenium::WebDriver::Error::WebDriverError:
    ...
    
    1203:  GetHandleVerifier [0x00007FF6C979BDBB+835995]
    1204:  (No symbol) [0x00007FF6C964EB5F]
    1205:  (No symbol) [0x00007FF6C964A814]
    1206:  (No symbol) [0x00007FF6C964A9AD]
    1207:  (No symbol) [0x00007FF6C963A199]
    1208:  BaseThreadInitThunk [0x00007FF99D7B4CB0+16]
    1209:  RtlUserThreadStart [0x00007FF99E75ECDB+43]
    1210:  2) Selenium::WebDriver::Chrome::Driver PrintsPage prints with valid params
    1211:  Failure/Error:
    1212:  expect(driver.print_page(orientation: 'landscape',
    1213:  page_ranges: ['1-2'],
    1214:  page: {width: 30})).to include(magic_number)
    1215:  Selenium::WebDriver::Error::TimeoutError:
    1216:  timeout: Timed out receiving message from renderer: 10.000
    1217:  (Session info: chrome=131.0.6778.85)
    1218:  # ./rb/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
    1219:  # ./rb/lib/selenium/webdriver/remote/response.rb:41:in `error'
    ...
    
    1224:  # ./rb/lib/selenium/webdriver/remote/http/default.rb:103:in `request'
    1225:  # ./rb/lib/selenium/webdriver/remote/http/common.rb:68:in `call'
    1226:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:685:in `execute'
    1227:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:421:in `print_page'
    1228:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:54:in `print_page'
    1229:  # ./rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb:72:in `block (3 levels) in <module:Chrome>'
    1230:  # ------------------
    1231:  # --- Caused by: ---
    1232:  # Selenium::WebDriver::Error::WebDriverError:
    ...
    
    1250:  GetHandleVerifier [0x00007FF6C979BDBB+835995]
    1251:  (No symbol) [0x00007FF6C964EB5F]
    1252:  (No symbol) [0x00007FF6C964A814]
    1253:  (No symbol) [0x00007FF6C964A9AD]
    1254:  (No symbol) [0x00007FF6C963A199]
    1255:  BaseThreadInitThunk [0x00007FF99D7B4CB0+16]
    1256:  RtlUserThreadStart [0x00007FF99E75ECDB+43]
    1257:  3) Selenium::WebDriver::Chrome::Driver PrintsPage saves pdf
    1258:  Failure/Error: driver.save_print_page path
    1259:  Selenium::WebDriver::Error::TimeoutError:
    1260:  timeout: Timed out receiving message from renderer: 10.000
    1261:  (Session info: chrome=131.0.6778.85)
    1262:  # ./rb/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
    1263:  # ./rb/lib/selenium/webdriver/remote/response.rb:41:in `error'
    ...
    
    1271:  # ./rb/lib/selenium/webdriver/remote/bridge.rb:421:in `print_page'
    1272:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:54:in `print_page'
    1273:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:37:in `block in save_print_page'
    1274:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:36:in `open'
    1275:  # ./rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb:36:in `save_print_page'
    1276:  # ./rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb:82:in `block (3 levels) in <module:Chrome>'
    1277:  # ------------------
    1278:  # --- Caused by: ---
    1279:  # Selenium::WebDriver::Error::WebDriverError:
    ...
    
    1297:  GetHandleVerifier [0x00007FF6C979BDBB+835995]
    1298:  (No symbol) [0x00007FF6C964EB5F]
    1299:  (No symbol) [0x00007FF6C964A814]
    1300:  (No symbol) [0x00007FF6C964A9AD]
    1301:  (No symbol) [0x00007FF6C963A199]
    1302:  BaseThreadInitThunk [0x00007FF99D7B4CB0+16]
    1303:  RtlUserThreadStart [0x00007FF99E75ECDB+43]
    1304:  Finished in 2 minutes 9 seconds (files took 1.04 seconds to load)
    1305:  14 examples, 3 failures
    1306:  Failed examples:
    1307:  rspec ./rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb:65 # Selenium::WebDriver::Chrome::Driver PrintsPage returns base64 for print command
    1308:  rspec ./rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb:70 # Selenium::WebDriver::Chrome::Driver PrintsPage prints with valid params
    1309:  rspec ./rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb:77 # Selenium::WebDriver::Chrome::Driver PrintsPage saves pdf
    1310:  ================================================================================
    1311:  �[32m[1,900 / 1,901]�[0m 25 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:script-chrome; 0s disk-cache
    1312:  �[32m[1,900 / 1,901]�[0m 25 / 31 tests, �[31m�[1m1 failed�[0m;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver/bidi:script-chrome
    1313:  �[32m[1,900 / 1,901]�[0m 25 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:script-chrome; 1s local, disk-cache
    1314:  �[32m[1,900 / 1,901]�[0m 25 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:script-chrome; 3s local, disk-cache
    1315:  �[32m[1,901 / 1,902]�[0m 26 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver:bidi-chrome; 0s disk-cache
    1316:  �[32m[1,901 / 1,902]�[0m 26 / 31 tests, �[31m�[1m1 failed�[0m;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver:bidi-chrome
    1317:  �[32m[1,901 / 1,902]�[0m 26 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver:bidi-chrome; 1s local, disk-cache
    1318:  �[32m[1,901 / 1,902]�[0m 26 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver:bidi-chrome; 3s local, disk-cache
    1319:  �[32m[1,902 / 1,903]�[0m 27 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:browsing_context-chrome; 0s disk-cache
    1320:  �[32m[1,902 / 1,903]�[0m 27 / 31 tests, �[31m�[1m1 failed�[0m;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver/bidi:browsing_context-chrome
    1321:  �[32m[1,902 / 1,903]�[0m 27 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:browsing_context-chrome; 1s local, disk-cache
    1322:  �[32m[1,902 / 1,903]�[0m 27 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:browsing_context-chrome; 3s local, disk-cache
    1323:  �[32m[1,903 / 1,904]�[0m 28 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:network-chrome; 0s disk-cache
    1324:  �[32m[1,903 / 1,904]�[0m 28 / 31 tests, �[31m�[1m1 failed�[0m;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver/bidi:network-chrome
    1325:  �[32m[1,903 / 1,904]�[0m 28 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:network-chrome; 1s local, disk-cache
    1326:  �[32m[1,903 / 1,904]�[0m 28 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:network-chrome; 3s local, disk-cache
    1327:  �[32m[1,904 / 1,905]�[0m 29 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver:devtools-chrome; 0s disk-cache
    1328:  �[32m[1,904 / 1,905]�[0m 29 / 31 tests, �[31m�[1m1 failed�[0m;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver:devtools-chrome
    1329:  �[32m[1,904 / 1,905]�[0m 29 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver:devtools-chrome; 1s local, disk-cache
    1330:  �[32m[1,904 / 1,905]�[0m 29 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver:devtools-chrome; 138s local, disk-cache
    1331:  �[32m[1,905 / 1,906]�[0m 30 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:log_inspector-chrome; 0s disk-cache
    1332:  �[32m[1,905 / 1,906]�[0m 30 / 31 tests, �[31m�[1m1 failed�[0m;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver/bidi:log_inspector-chrome
    1333:  �[32m[1,905 / 1,906]�[0m 30 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:log_inspector-chrome; 1s local, disk-cache
    1334:  �[32m[1,905 / 1,906]�[0m 30 / 31 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:log_inspector-chrome; 3s local, disk-cache
    1335:  �[32mINFO: �[0mFound 31 test targets...
    1336:  �[32mINFO: �[0mElapsed time: 1420.073s, Critical Path: 870.27s
    1337:  �[32mINFO: �[0m1906 processes: 984 disk cache hit, 845 internal, 77 local.
    1338:  �[32mINFO: �[0mBuild completed, 1 test FAILED, 1906 total actions
    1339:  //rb/spec/integration/selenium/webdriver:action_builder-chrome           �[0m�[32mPASSED�[0m in 17.1s
    1340:  //rb/spec/integration/selenium/webdriver:bidi-chrome                     �[0m�[32mPASSED�[0m in 3.6s
    1341:  //rb/spec/integration/selenium/webdriver:devtools-chrome                 �[0m�[32mPASSED�[0m in 138.6s
    1342:  //rb/spec/integration/selenium/webdriver:driver-chrome                   �[0m�[32mPASSED�[0m in 16.1s
    1343:  //rb/spec/integration/selenium/webdriver:element-chrome                  �[0m�[32mPASSED�[0m in 19.6s
    1344:  //rb/spec/integration/selenium/webdriver:error-chrome                    �[0m�[32mPASSED�[0m in 9.4s
    ...
    
    1361:  //rb/spec/integration/selenium/webdriver/bidi:log_inspector-chrome       �[0m�[32mPASSED�[0m in 3.7s
    1362:  //rb/spec/integration/selenium/webdriver/bidi:network-chrome             �[0m�[32mPASSED�[0m in 3.6s
    1363:  //rb/spec/integration/selenium/webdriver/bidi:script-chrome              �[0m�[32mPASSED�[0m in 3.7s
    1364:  //rb/spec/integration/selenium/webdriver/chrome:options-chrome           �[0m�[32mPASSED�[0m in 8.2s
    1365:  //rb/spec/integration/selenium/webdriver/chrome:profile-chrome           �[0m�[32mPASSED�[0m in 4.5s
    1366:  //rb/spec/integration/selenium/webdriver/chrome:service-chrome           �[0m�[32mPASSED�[0m in 7.4s
    1367:  //rb/spec/integration/selenium/webdriver/remote:driver-chrome            �[0m�[32mPASSED�[0m in 4.3s
    1368:  //rb/spec/integration/selenium/webdriver/remote:element-chrome           �[0m�[32mPASSED�[0m in 18.7s
    1369:  //rb/spec/integration/selenium/webdriver/chrome:driver-chrome            �[0m�[31m�[1mFAILED�[0m in 3 out of 3 in 131.5s
    1370:  Stats over 3 runs: max = 131.5s, min = 130.8s, avg = 131.1s, dev = 0.3s
    1371:  D:/_bazel/execroot/_main/bazel-out/x64_windows-fastbuild/testlogs/rb/spec/integration/selenium/webdriver/chrome/driver-chrome/test.log
    1372:  D:/_bazel/execroot/_main/bazel-out/x64_windows-fastbuild/testlogs/rb/spec/integration/selenium/webdriver/chrome/driver-chrome/test_attempts/attempt_1.log
    1373:  D:/_bazel/execroot/_main/bazel-out/x64_windows-fastbuild/testlogs/rb/spec/integration/selenium/webdriver/chrome/driver-chrome/test_attempts/attempt_2.log
    1374:  Executed 31 out of 31 tests: 30 tests pass and �[0m�[31m�[1m1 fails locally�[0m.
    1375:  There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
    1376:  �[0m
    1377:  ##[error]Process completed with exit code 1.
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    Copy link
    Member

    @p0deje p0deje left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    navigate and reload return NavigateResult objects; should I return it as a Struct or just ignore it since we aren't doing anything with it and not promising a return value?

    I think it's fine not to return anything so far.

    Should these BiDi classes be marked private api?

    Yes, please.

    I want to implement this as BrowsingContext instead of creating a new class and deprecating that one; do we need to be backwards compatible with this since we didn't mark it private api?

    I think it should be fine to change it since it was part of BiDi which is not widely used.

    rb/lib/selenium/webdriver/bidi/context_manager.rb Outdated Show resolved Hide resolved
    rb/lib/selenium/webdriver/bidi/context_manager.rb Outdated Show resolved Hide resolved
    @titusfortner
    Copy link
    Member Author

    /improve

    @aguspe aguspe merged commit fefdba1 into trunk Nov 20, 2024
    20 of 23 checks passed
    @aguspe aguspe deleted the rb_bidi_nav branch November 20, 2024 18:16
    @aguspe
    Copy link
    Contributor

    aguspe commented Nov 20, 2024

    Thank you for your contribution @titusfortner ! Have a great day!

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants