webdriver.extensions.flutter_integration package

Submodules

webdriver.extensions.flutter_integration.flutter_commands module

class FlutterCommand(driver: WebDriver)

Bases: object

activate_injected_image(image_id: str) None

Activates an injected image with image ID.

Parameters:

image_id (str) – The ID of the injected image to activate.

Return type:

None

execute_flutter_command(scriptName: str, params: dict) Any

Executes a Flutter command by sending a script and parameters to the flutter integration driver.

Parameters:
  • scriptName (str) – The name of the Flutter command to execute. This will be prefixed with ‘flutter:’ when passed to the driver.

  • params (dict) – A dictionary of parameters to be passed along with the Flutter command.

Returns:

The result of the command execution. The return value depends on the specific Flutter command being executed.

Return type:

Any

inject_mock_image(value: str) str

Injects a mock image to the device. The input can be a file path or a base64-encoded string.

Parameters:

value (str) – The file path of the image or a base64-encoded string.

Returns:

Image ID of the injected image.

Return type:

str

perform_double_click(element: WebElement, offset: Tuple[int, int] | None = None) None

Performs a double-click on the given element, with an optional offset.

Parameters:
  • element (WebElement) – The element to double-click on. This parameter is required.

  • offset (Optional[Tuple[int, int]]) – The x and y offsets from the element to click at. If not specified, the click is performed at the element’s center.

Return type:

None

perform_drag_and_drop(source: WebElement, target: WebElement) None

Performs a drag-and-drop operation from a source element to a target element.

Parameters:
  • source (WebElement) – The element to drag from.

  • target (WebElement) – The element to drop onto.

Return type:

None

perform_long_press(element: WebElement, offset: Tuple[int, int] | None = None) None

Performs a long press on the given element, with an optional offset.

Parameters:
  • element (WebElement) – The element to perform the long press on. This parameter is required.

  • offset (Optional[Tuple[int, int]]) – The x and y offsets from the element to perform the long press at. If not specified, the long press is performed at the element’s center.

Return type:

None

scroll_till_visible(scroll_to: FlutterFinder, scroll_direction: ScrollDirection = ScrollDirection.DOWN, **opts: Any) WebElement

Scrolls until the specified element becomes visible.

Parameters:
  • scroll_to (FlutterFinder) – The Flutter element to scroll to.

  • scroll_direction (ScrollDirection) – The direction to scroll up or down. Defaults to ScrollDirection.DOWN.

KeywordArgs:

scrollView (str): The view of the scroll. Default value is ‘Scrollable’ delta (int): delta for the scroll. Default value is 64 maxScrolls (int): Max times to scroll. Default value is 15 settleBetweenScrollsTimeout (float): settle timeout in milliseconds. Default value is 5000 dragDuration (float): time gap between each scroll in milliseconds. Default value is 100

Returns:

scrolled element

Return type:

Webelement

wait_for_invisible(locator: WebElement | FlutterFinder, timeout: float | None = None) None

Waits for a element to become invisible.

Parameters:
  • locator (Union[WebElement, FlutterFinder]) – The element to wait for; can be a WebElement or a FlutterFinder.

  • timeout (Optional[float]) – Maximum wait time in seconds. Defaults to a predefined timeout if not specified.

Return type:

None

wait_for_visible(locator: WebElement | FlutterFinder, timeout: float | None = None) None

Waits for a element to become visible.

Parameters:
  • locator (Union[WebElement, FlutterFinder]) – The element to wait for; can be a WebElement or a FlutterFinder.

  • timeout (Optional[float]) – Maximum wait time in seconds. Defaults to a predefined timeout if not specified.

Return type:

None

webdriver.extensions.flutter_integration.flutter_finder module

class FlutterFinder(using: Literal['id', 'xpath', 'link text', 'partial link text', 'name', 'tag name', 'class name', 'css selector', '-ios predicate string', '-ios class chain', '-android uiautomator', '-android viewtag', '-android datamatcher', '-android viewmatcher', 'accessibility id', '-image', '-custom', '-flutter semantics label', '-flutter type', '-flutter key', '-flutter text containing'], value: str)

Bases: object

as_args() Tuple[str, str]
static by_key(value: str) FlutterFinder
static by_semantics_label(value: str) FlutterFinder
static by_text(value: str) FlutterFinder
static by_text_containing(value: str) FlutterFinder
static by_type(value: str) FlutterFinder
to_dict() dict

webdriver.extensions.flutter_integration.scroll_directions module

class ScrollDirection(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

DOWN = 'down'
UP = 'up'

Module contents