Skip to content

docs: re-run the gen code #1129

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

Merged
merged 3 commits into from
May 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions appium/options/common/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ def as_w3c(capabilities: Dict) -> Dict:
"""
Formats given capabilities to a valid W3C session request object

:param capabilities: Capabilities mapping
:return: W3C session request object
Args:
capabilities: Capabilities mapping

Returns:
W3C session request object
"""

def process_key(k: str) -> str:
Expand Down
11 changes: 6 additions & 5 deletions appium/webdriver/appium_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ class AppiumConnection(RemoteConnection):
"""
A subclass of selenium.webdriver.remote.remote_connection.Remoteconnection.

The changes are:
- The default user agent
- Adds 'X-Idempotency-Key' header in a new session request to avoid proceeding
the same request multiple times in the Appium server side.
- https://github.com/appium/appium-base-driver/pull/400
The changes are

* The default user agent
* Adds 'X-Idempotency-Key' header in a new session request to avoid proceeding
the same request multiple times in the Appium server side.
* https://github.com/appium/appium-base-driver/pull/400
"""

user_agent = f'{PREFIX_HEADER}{library_version()} ({RemoteConnection.user_agent})'
Expand Down
27 changes: 17 additions & 10 deletions appium/webdriver/appium_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def start(self, **kwargs: Any) -> sp.Popen:

The service will be forcefully restarted if it is already running.

Keyword Args:
Args:
env (dict): Environment variables mapping. The default system environment,
which is inherited from the parent process, is assigned by default.
node (str): The full path to the main NodeJS executable. The service will try
Expand All @@ -75,9 +75,10 @@ def start(self, **kwargs: Any) -> sp.Popen:
https://appium.io/docs/en/writing-running-appium/server-args/ for more details
about possible arguments and their values.

:return: You can use Popen.communicate interface or stderr/stdout properties
Returns: You can use Popen.communicate interface or stderr/stdout properties
of the instance (stdout/stderr must not be set to None in such case) in order to retrieve the actual process
output.

"""
self.stop()

Expand Down Expand Up @@ -134,9 +135,11 @@ def stop(self, timeout: float = 5.5) -> bool:
The call will be ignored if the service is not running
or has been already stopped.

:param timeout: The maximum time in float seconds to wait
for the server process to terminate
:return: `True` if the service was running before being stopped
Args:
timeout: The maximum time in float seconds to wait for the server process to terminate

Returns:
`True` if the service was running before being stopped
"""
was_running = False
if self.is_running:
Expand Down Expand Up @@ -170,7 +173,8 @@ def is_listening(self) -> bool:
The default host/port/base path values can be customized by providing
--address/--port/--base-path command line arguments while starting the service.

:return: `True` if the service is running and listening on the given/default host/port
Returns:
`True` if the service is running and listening on the given/default host/port
"""
if not self.is_running:
return False
Expand All @@ -194,10 +198,13 @@ def is_service_listening(url: str, timeout: float = 5, custom_validator: Optiona
"""
Check if the service is running

:param url: Full server url
:param timeout: Timeout in float seconds
:param custom_validator: Custom callable method to be executed upon each validation loop before the timeout happens
:return: True if Appium server is running before the timeout
Args:
url: Full server url
timeout: Timeout in float seconds
custom_validator: Custom callable method to be executed upon each validation loop before the timeout happens

Returns:
True if Appium server is running before the timeout
"""
time_started_sec = time.perf_counter()
conn = urllib3.PoolManager(timeout=1.0)
Expand Down
139 changes: 72 additions & 67 deletions appium/webdriver/extensions/flutter_integration/flutter_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def wait_for_visible(
timeout (Optional[float]): Maximum wait time in seconds. Defaults to a predefined timeout if not specified.

Returns:
None:
None
"""
opts: Dict[str, Any] = self.__get_locator_options(locator)
if timeout is not None:
Expand Down Expand Up @@ -193,72 +193,77 @@ def get_render_tree(
such as type, key, size, attribute, state, visual information, and hierarchy.

The example widget includes the following code, which is rendered as part of the widget tree:
```dart
Semantics(
key: const Key('add_activity_semantics'),
label: 'add_activity_button',
button: true,
child: FloatingActionButton.small(
key: const Key('add_activity_button'),
tooltip: 'add_activity_button',
heroTag: 'add',
backgroundColor: const Color(0xFF2E2E3A),
onPressed: null,
child: Icon(
Icons.add,
size: 16,
color: Colors.amber.shade200.withOpacity(0.5),
semanticLabel: 'Add icon',
),
),
),
```
Example execute command:
>>> flutter_command = FlutterCommand(driver) # noqa
>>> flutter_command.get_render_tree(widget_type='Semantics', key='add_activity_semantics')
output >> [
{
"type": "Semantics",
"elementType": "SingleChildRenderObjectElement",
"description": "Semantics-[<'add_activity_semantics'>]",
"depth": 0,
"key": "[<'add_activity_semantics'>]",
"attributes": {
"semanticsLabel": "add_activity_button"
},
"visual": {},
"state": {},
"rect": {
"x": 0,
"y": 0,
"width": 48,
"height": 48
},
"children": [
{
"type": "FloatingActionButton",
"elementType": "StatelessElement",
"description": "FloatingActionButton-[<'add_activity_button'>]",
"depth": 1,
"key": "[<'add_activity_button'>]",
"attributes": {},
"visual": {},
"state": {},
"rect": {
"x": 0,
"y": 0,
"width": 48,
"height": 48
},
"children": [
{...},
"children": [...]
}
]
}
]
}
]

.. code-block:: dart

Semantics(
key: const Key('add_activity_semantics'),
label: 'add_activity_button',
button: true,
child: FloatingActionButton.small(
key: const Key('add_activity_button'),
tooltip: 'add_activity_button',
heroTag: 'add',
backgroundColor: const Color(0xFF2E2E3A),
onPressed: null,
child: Icon(
Icons.add,
size: 16,
color: Colors.amber.shade200.withOpacity(0.5),
semanticLabel: 'Add icon',
),
),
)

Example execute command:

.. code-block:: python

>>> flutter_command = FlutterCommand(driver) # noqa
>>> flutter_command.get_render_tree(widget_type='Semantics', key='add_activity_semantics')
output >> [
{
"type": "Semantics",
"elementType": "SingleChildRenderObjectElement",
"description": "Semantics-[<'add_activity_semantics'>]",
"depth": 0,
"key": "[<'add_activity_semantics'>]",
"attributes": {
"semanticsLabel": "add_activity_button"
},
"visual": {},
"state": {},
"rect": {
"x": 0,
"y": 0,
"width": 48,
"height": 48
},
"children": [
{
"type": "FloatingActionButton",
"elementType": "StatelessElement",
"description": "FloatingActionButton-[<'add_activity_button'>]",
"depth": 1,
"key": "[<'add_activity_button'>]",
"attributes": {},
"visual": {},
"state": {},
"rect": {
"x": 0,
"y": 0,
"width": 48,
"height": 48
},
"children": [
{...},
"children": [...]
}
]
}
]
}
]
"""
opts = {}
if widget_type is not None:
Expand Down
22 changes: 11 additions & 11 deletions appium/webdriver/extensions/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ def log_types(self) -> List[str]:
compliant browsers.

Example:
--------
>>> driver.log_types
.. code-block:: python

driver.log_types
"""
return self.execute(Command.GET_AVAILABLE_LOG_TYPES)['value']

def get_log(self, log_type: str) -> List[Dict[str, Any]]:
"""Gets the log for a given log type.

Parameters:
----------
log_type : str
- Type of log that which will be returned
Args:
log_type: Type of log that which will be returned

Example:
--------
>>> driver.get_log('browser')
>>> driver.get_log('driver')
>>> driver.get_log('client')
>>> driver.get_log('server')
.. code-block:: python

driver.get_log('browser')
driver.get_log('driver')
driver.get_log('client')
driver.get_log('server')
"""
return self.execute(Command.GET_LOG, {'type': log_type})['value']

Expand Down
Loading