Skip to content

Commit 8871956

Browse files
correct signature
1 parent 5d72873 commit 8871956

2 files changed

Lines changed: 69 additions & 36 deletions

File tree

py/private/bidi_enhancements_manifest.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,38 @@ class SetNetworkConditionsParameters:
584584
if user_contexts is not None:
585585
params["userContexts"] = user_contexts
586586
cmd = command_builder("emulation.setNetworkConditions", params)
587+
return self._conn.execute(cmd)''',
588+
''' def set_screen_settings_override(
589+
self,
590+
width: int | None = None,
591+
height: int | None = None,
592+
contexts: list[Any] | None = None,
593+
user_contexts: list[Any] | None = None,
594+
):
595+
"""Execute emulation.setScreenSettingsOverride.
596+
597+
Sets or clears the screen settings override for specified browsing or user
598+
contexts.
599+
600+
Args:
601+
width: The screen width in pixels, or ``None`` to clear the override.
602+
height: The screen height in pixels, or ``None`` to clear the override.
603+
contexts: List of browsing context IDs to target.
604+
user_contexts: List of user context IDs to target.
605+
"""
606+
screen_area = None
607+
if width is not None or height is not None:
608+
screen_area = {}
609+
if width is not None:
610+
screen_area["width"] = width
611+
if height is not None:
612+
screen_area["height"] = height
613+
params: dict[str, Any] = {"screenArea": screen_area}
614+
if contexts is not None:
615+
params["contexts"] = contexts
616+
if user_contexts is not None:
617+
params["userContexts"] = user_contexts
618+
cmd = command_builder("emulation.setScreenSettingsOverride", params)
587619
return self._conn.execute(cmd)''',
588620
],
589621
},

py/selenium/webdriver/common/bidi/emulation.py

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1-
# Licensed to the Software Freedom Conservancy (SFC) under one
2-
# or more contributor license agreements. See the NOTICE file
3-
# distributed with this work for additional information
4-
# regarding copyright ownership. The SFC licenses this file
5-
# to you under the Apache License, Version 2.0 (the
6-
# "License"); you may not use this file except in compliance
7-
# with the License. You may obtain a copy of the License at
1+
# DO NOT EDIT THIS FILE!
82
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
3+
# This file is generated from the WebDriver BiDi specification. If you need to make
4+
# changes, edit the generator and regenerate all of the modules.
105
#
11-
# Unless required by applicable law or agreed to in writing,
12-
# software distributed under the License is distributed on an
13-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
# KIND, either express or implied. See the License for the
15-
# specific language governing permissions and limitations
16-
# under the License.
17-
18-
6+
# WebDriver BiDi module: emulation
197
from __future__ import annotations
208

219
from dataclasses import dataclass, field
@@ -237,26 +225,6 @@ def set_locale_override(
237225
result = self._conn.execute(cmd)
238226
return result
239227

240-
def set_screen_settings_override(
241-
self,
242-
screen_area: Any | None = None,
243-
contexts: list[Any] | None = None,
244-
user_contexts: list[Any] | None = None,
245-
):
246-
"""Execute emulation.setScreenSettingsOverride."""
247-
if screen_area is None:
248-
raise TypeError("set_screen_settings_override() missing required argument: 'screen_area'")
249-
250-
params = {
251-
"screenArea": screen_area,
252-
"contexts": contexts,
253-
"userContexts": user_contexts,
254-
}
255-
params = {k: v for k, v in params.items() if v is not None}
256-
cmd = command_builder("emulation.setScreenSettingsOverride", params)
257-
result = self._conn.execute(cmd)
258-
return result
259-
260228
def set_scrollbar_type_override(
261229
self,
262230
scrollbar_type: Any | None = None,
@@ -485,3 +453,36 @@ def set_network_conditions(
485453
params["userContexts"] = user_contexts
486454
cmd = command_builder("emulation.setNetworkConditions", params)
487455
return self._conn.execute(cmd)
456+
457+
def set_screen_settings_override(
458+
self,
459+
width: int | None = None,
460+
height: int | None = None,
461+
contexts: list[Any] | None = None,
462+
user_contexts: list[Any] | None = None,
463+
):
464+
"""Execute emulation.setScreenSettingsOverride.
465+
466+
Sets or clears the screen settings override for specified browsing or user
467+
contexts.
468+
469+
Args:
470+
width: The screen width in pixels, or ``None`` to clear the override.
471+
height: The screen height in pixels, or ``None`` to clear the override.
472+
contexts: List of browsing context IDs to target.
473+
user_contexts: List of user context IDs to target.
474+
"""
475+
screen_area = None
476+
if width is not None or height is not None:
477+
screen_area = {}
478+
if width is not None:
479+
screen_area["width"] = width
480+
if height is not None:
481+
screen_area["height"] = height
482+
params: dict[str, Any] = {"screenArea": screen_area}
483+
if contexts is not None:
484+
params["contexts"] = contexts
485+
if user_contexts is not None:
486+
params["userContexts"] = user_contexts
487+
cmd = command_builder("emulation.setScreenSettingsOverride", params)
488+
return self._conn.execute(cmd)

0 commit comments

Comments
 (0)