-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
#16573 unwrap double-wrapped webdriver #16575
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
#16573 unwrap double-wrapped webdriver #16575
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||||||
|
Thank you, @asolntsev for this code suggestion. The support packages contain example code that many users find helpful, but they do not necessarily represent After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks. |
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
107b41b to
363c915
Compare
java/src/org/openqa/selenium/support/decorators/WebDriverDecorator.java
Outdated
Show resolved
Hide resolved
363c915 to
2276be4
Compare
2276be4 to
3d0a440
Compare
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
User description
🔗 Related Issues
Fixes #16573
💥 What does this PR do?
Fix
WebDriverDecoratorto properly decorate WebDriver instance that is already decorated.🔄 Types of changes
Test
I have a test, but not sure where to put it in Selenium project codebase:
PR Type
Bug fix
Description
Fix WebDriverDecorator to properly unwrap double-wrapped WebDriver instances
Add recursive unwrapping logic to handle nested WrapsDriver decorators
Ensure getWrappedDriver returns the original unwrapped driver
Add test coverage for multiple decorator wrapping scenarios
Diagram Walkthrough
File Walkthrough
WebDriverDecorator.java
Add recursive unwrapping for nested WebDriver decoratorsjava/src/org/openqa/selenium/support/decorators/WebDriverDecorator.java
unwrapOriginal()method to recursively unwrap decoratedWebDriver instances
unwrapWebdriver()method that recursively extracts the basedriver from nested WrapsDriver wrappers
Definitionconstructor to useunwrapOriginal()instead ofdirect
getOriginal()callderiveAdditionalInterfaces()to return unwrapped driver forall WebDriver instances and handle WrapsDriver case properly
DecoratedRemoteWebDriverTest.java
Add test coverage for multiple decorator wrappingjava/test/org/openqa/selenium/support/decorators/DecoratedRemoteWebDriverTest.java
instance
canWrapDriverMultipleTimes()to verify multipledecorator wrapping works correctly
original driver
regardless of wrapping depth