|
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! |
8 | 2 | # |
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. |
10 | 5 | # |
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 |
19 | 7 | from __future__ import annotations |
20 | 8 |
|
21 | 9 | from dataclasses import dataclass, field |
@@ -237,26 +225,6 @@ def set_locale_override( |
237 | 225 | result = self._conn.execute(cmd) |
238 | 226 | return result |
239 | 227 |
|
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 | | - |
260 | 228 | def set_scrollbar_type_override( |
261 | 229 | self, |
262 | 230 | scrollbar_type: Any | None = None, |
@@ -485,3 +453,36 @@ def set_network_conditions( |
485 | 453 | params["userContexts"] = user_contexts |
486 | 454 | cmd = command_builder("emulation.setNetworkConditions", params) |
487 | 455 | 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