[py] Route Safari, STP and WebView2 to their handlers - #17728
Conversation
get_remote_connection() compared browserName against string literals, but some options classes emit values those literals don't match: SafariOptions emits "safari" / "Safari Technology Preview", and EdgeOptions(use_webview=True) emits "webview2". Those sessions fell back to the base RemoteConnection, losing the browser-specific commands and raising a remote_server_addr DeprecationWarning whose message points away from the real cause. Match the emitted values, consistent with the chrome and firefox branches, and add a test that drives handler selection from each options class's emitted capabilities.
PR Summary by QodoFix get_remote_connection routing for Safari, STP, and Edge WebView2 Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
Context used✅ Tickets:
🎫 2.48 doesn't trigger javascript in link's href on click() 🎫 Instance ChroneDriver Error: ConnectFailure✅ Compliance rules (platform):
17 rules 1.
|
|
Code review by qodo was updated up to the latest commit fbbf570 |
|
Code review by qodo was updated up to the latest commit d231739 |
cgoldberg
left a comment
There was a problem hiding this comment.
LGTM.. I just kicked off CI.
|
@v-dermichev thanks for contributing! |
🔗 Related Issues
No existing issue; the root cause and reproduction are described below.
Related (the broader warning topic): #14686, #14792.
💥 What does this PR do?
get_remote_connection()picks the per-browserRemoteConnectionby comparing the requestedbrowserNameagainst string literals, but several options classes emit values those literals don't match:SafariOptionsemits"safari"(DesiredCapabilities.SAFARI), while the branch compared against"Safari"(capital S);SafariOptionswithuse_technology_preview = Trueemits"Safari Technology Preview";EdgeOptionswithuse_webview = Trueemits"webview2".In each case selection fell through to the base
RemoteConnection. That has two effects: the browser-specific commands (e.g. those registered bySafariRemoteConnection) are lost, and the baseRemoteConnectionreceivesremote_server_addrdirectly and emits aremote_server_addrDeprecationWarningwhose message points atclient_config, away from the real cause.This matches the values each options class actually emits, consistent with the
chromeandfirefoxbranches.Highlighted issues can be reproduced by running tests included in this PR, 3 will fail (STP, WebView2 and Safari)
🔧 Implementation Notes
browserNameeach options class can emit: Edge →("MicrosoftEdge", "webview2")(WebView2), Safari →("safari", "Safari Technology Preview")(Technology Preview); Chrome/Firefox emit a single value. This mirrors the existingin ("MicrosoftEdge", "webview2")check already used elsewhere inwebdriver.py.*Options().to_capabilities()(with theuse_webview/use_technology_previewflags set), so the emitted capability value and the handler lookup cannot drift apart without the test catching it.🤖 AI assistance
💡 Additional Considerations
An unrecognised
browserNamestill falls back to the baseRemoteConnection(and would trip the same warning); that is the intended default. The broader "remote_server_addrdeprecation fires from Selenium's own default path" topic is tracked in #14686 / #14792.🔄 Types of changes