[rb] better: allow to use devtools which are all upercase.#11912
[rb] better: allow to use devtools which are all upercase.#11912ylecuyer wants to merge 1 commit intoSeleniumHQ:trunkfrom
Conversation
p0deje
left a comment
There was a problem hiding this comment.
What is the benefit of having this? This kind of API is not idiomatic to Ruby - methods should be named lowercase and underscore.
|
I think the issue is our use of |
|
Oh, I understand what the problem is now. Let me suggest a different solution - we should maintain a simple mapping of methods to classes. This can already be generated from the CDP spec and could look like this: METHODS_TO_CLASSES = {
accessibility: 'Accessibility',
animation: 'Animation',
audits: 'Audits',
background_service: 'BackgroundService',
browser: 'Browser',
css: 'CSS',
cache_storage: 'CacheStorage',
cast: 'Cast',
dom: 'DOM',
dom_debugger: 'DOMDebugger',
event_breakpoints: 'EventBreakpoints',
dom_snapshot: 'DOMSnapshot',
dom_storage: 'DOMStorage',
database: 'Database',
device_orientation: 'DeviceOrientation',
emulation: 'Emulation',
headless_experimental: 'HeadlessExperimental',
io: 'IO',
indexed_db: 'IndexedDB',
input: 'Input',
inspector: 'Inspector',
layer_tree: 'LayerTree',
log: 'Log',
memory: 'Memory',
network: 'Network',
overlay: 'Overlay',
page: 'Page',
performance: 'Performance',
performance_timeline: 'PerformanceTimeline',
security: 'Security',
service_worker: 'ServiceWorker',
storage: 'Storage',
system_info: 'SystemInfo',
target: 'Target',
tethering: 'Tethering',
tracing: 'Tracing',
fetch: 'Fetch',
web_audio: 'WebAudio',
web_authn: 'WebAuthn',
media: 'Media',
device_access: 'DeviceAccess',
preload: 'Preload',
console: 'Console',
debugger: 'Debugger',
heap_profiler: 'HeapProfiler',
profiler: 'Profiler',
runtime: 'Runtime',
schema: 'Schema',
}.freezeThis way we can preserve snake_case methods while ensuring all APIs are accessible. |
|
@ylecuyer Thank you for the PR. I've just pushed a different implementation, based on the previous comment. The fix will be available in the next release. Until then, later today a new nightly version of selenium-devtools and selenium-webdriver gems will be available on GitHub if you want to try using them - https://github.com/orgs/SeleniumHQ/packages?repo_name=selenium. |
|
Great 👍 many thanks |
Description
This PR allows to get devtools domains which are uppercased (because there is a force capitalize atm)
Before
Now
Types of changes
Checklist
Couldn't check the tests as I don't have bazel installed