-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[rb] BiDi get client windows #16211
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
base: trunk
Are you sure you want to change the base?
[rb] BiDi get client windows #16211
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
… rb_bidi_get_client_windows
… rb_bidi_get_client_windows
User description
💥 What does this PR do?
This pull request adds support for listing and inspecting client windows through the Selenium BiDi (Bidirectional) protocol in Ruby.
It introduces a new class, WebDriver::BiDi::Browser::Window, which is a Struct that holds information about a browser window, including its handle, active state, and dimensions (height, width, x, y).
Adds a new method, windows, to the WebDriver::BiDi::Browser class. This method uses the browser.getClientWindows command to retrieve a list of all client windows and returns them as an array of Window objects.
I'm investigating how its suppose to work on Firefox, because it works as expected however Firefox doesn't seem to set the first window to active as Chrome does.
🔧 Implementation Notes
I've chosen to implement the Window class as a Struct because it's a lightweight, efficient way to bundle related data together without needing a full-blown class. This approach aligns well with how simple data objects are often handled in Ruby and provides a clean, predictable API for users.
I also added a helper method, active?, to the Window struct to make checking the active state more idiomatic for Ruby users.
🔄 Types of changes
PR Type
Enhancement
Description
Add BiDi
windows
method to retrieve client windowsCreate
Window
struct with handle, active state, dimensionsAdd comprehensive test coverage for window operations
Update Ruby type signatures for new functionality
Diagram Walkthrough
File Walkthrough
browser.rb
Add BiDi client windows functionality
rb/lib/selenium/webdriver/bidi/browser.rb
Window
struct with handle, dimensions, and state propertieswindows
method to fetch client windows via BiDiactive?
helper method for window active statebrowsing_context.rb
Minor formatting improvement
rb/lib/selenium/webdriver/bidi/browsing_context.rb
browser_spec.rb
Add BiDi windows tests and refactor
rb/spec/integration/selenium/webdriver/bidi/browser_spec.rb
windows
methodbrowser.rbs
Update Ruby type signatures
rb/sig/lib/selenium/webdriver/bidi/browser.rbs
Window
struct