-
-
Couldn't load subscription status.
- Fork 8.6k
[py][bidi]: add set_screen_orientation_override command in Emulation
#16522
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?
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 |
||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||
User description
🔗 Related Issues
💥 What does this PR do?
Adds the
set_screen_orientation_overridecommand to the Emulation module - https://w3c.github.io/webdriver-bidi/#command-emulation-setScreenOrientationOverride.🔧 Implementation Notes
Usage:
Using ENUM:
Using strings:
💡 Additional Considerations
Supported by both chromium and Firefox.
We can set the natural orientation and the type via ENUMs or through strings directly.
_convert_to_enuminternally converts str to enum and raises value error in wrong string is passed.🔄 Types of changes
PR Type
Enhancement
Description
Adds
set_screen_orientation_overridecommand to Emulation moduleImplements
ScreenOrientationclass with enum supportSupports both enum and string-based orientation configuration
Includes comprehensive tests for contexts and user contexts
Diagram Walkthrough
File Walkthrough
emulation.py
Implement screen orientation override functionalitypy/selenium/webdriver/common/bidi/emulation.py
ScreenOrientationNaturalandScreenOrientationTypeenums fororientation values
_convert_to_enum()helper function to convert strings toenums with validation
ScreenOrientationclass to encapsulate natural and typeorientation settings
set_screen_orientation_override()method to apply orientationoverrides to contexts or user contexts
provided, but not both
bidi_emulation_tests.py
Add comprehensive screen orientation override testspy/test/selenium/webdriver/common/bidi_emulation_tests.py
ScreenOrientation,ScreenOrientationNatural, andScreenOrientationTypeget_screen_orientation()helper function to retrievecurrent screen orientation and angle
test_set_screen_orientation_override_with_contexts()to testorientation changes with browsing contexts
test_set_screen_orientation_override_with_user_contexts()covering allorientation combinations