### Install Appium Python Client from GitHub Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/python/README.md Clone the Appium Python client repository from GitHub and install it using the setup script. This method is for installing from source via GitHub. ```shell git clone git@github.com:appium/python-client.git cd python-client python setup.py install ``` -------------------------------- ### Install Appium Flutter Finder from Source Tarball Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/python/README.md Install the Appium Flutter Finder by downloading the source tarball, extracting it, and running the setup script. ```shell tar -xvf Appium-Flutter-Finder-X.X.tar.gz cd Appium-Flutter-Finder-X.X python setup.py install ``` -------------------------------- ### Install Appium Globally Source: https://github.com/appium/appium-flutter-driver/blob/main/example/nodejs/README.md Installs the Appium server globally on your system. ```bash npm i -g appium ``` -------------------------------- ### Install Dependencies Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/ruby/README.md Run this command after checking out the repository to install necessary dependencies for development. ```bash bin/setup ``` -------------------------------- ### Start Appium Server Source: https://github.com/appium/appium-flutter-driver/blob/main/example/nodejs/README.md Starts the Appium server. This command should be run in a separate terminal. ```bash appium ``` -------------------------------- ### Install Node Modules Source: https://github.com/appium/appium-flutter-driver/blob/main/example/nodejs/README.md Installs all necessary Node.js modules for the project. ```bash npm install ``` -------------------------------- ### Install Local Gem Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/ruby/README.md Run this command to install the gem onto your local machine. ```bash bundle exec rake install ``` -------------------------------- ### Install Gem Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/ruby/README.md Execute this command in your terminal to install the AppiumFlutterFinder gem. ```bash $ gem install appium_flutter_finder ``` -------------------------------- ### Prepare for Release Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/python/README.md Install the 'twine' package, which is used for uploading Python packages to PyPI. ```shell pip install twine ``` -------------------------------- ### Start Interactive Console Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/ruby/README.md Use this command to launch an interactive Ruby console for experimenting with the gem. ```bash bin/console ``` -------------------------------- ### Install Appium Flutter Finder from PyPi Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/python/README.md Use this command to install the Appium Flutter Finder package directly from the Python Package Index. ```shell pip install Appium-Flutter-Finder ``` -------------------------------- ### Install Appium Flutter Driver Locally Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Installs the Appium Flutter Driver from a local path. Useful for development or custom builds. ```bash appium driver install --source local /path/to/appium-flutter-driver/driver ``` -------------------------------- ### Install Appium Flutter Driver from NPM Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Installs the Appium Flutter Driver using the npm package manager. Requires Appium 3. ```bash appium driver install --source=npm appium-flutter-driver ``` -------------------------------- ### Install TypeScript Globally Source: https://github.com/appium/appium-flutter-driver/blob/main/example/nodejs/README.md Installs TypeScript globally, which is required for the TypeScript compile to work. ```bash npm install -g typescript ``` -------------------------------- ### Node.js: Drag and Drop with Command Extension Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Perform a drag and drop action in Node.js using the flutter:dragAndDropWithCommandExtension command. This example specifies start and end coordinates and a duration. ```typescript // Extended commands: flutter:dragAndDropWithCommandExtension const payload = { "startX": "100", "startY": "100", "endX": "100", "endY": "600", "duration": "15000" } const result = await driver.execute("flutter:dragAndDropWithCommandExtension", payload); console.log(JSON.stringify(result)); ``` -------------------------------- ### Run Node.js Tests for iOS Source: https://github.com/appium/appium-flutter-driver/blob/main/example/nodejs/README.md Starts the Node.js tests with the Appium OS environment variable set to iOS. ```bash APPIUM_OS=ios npm start ``` -------------------------------- ### Run Node.js Tests for Android Source: https://github.com/appium/appium-flutter-driver/blob/main/example/nodejs/README.md Starts the Node.js tests with the Appium OS environment variable set to Android. ```bash APPIUM_OS=android npm start ``` -------------------------------- ### Get VM Info and Set Isolate ID in Ruby Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md This snippet shows how to retrieve VM information to get available isolate IDs and then set the target engine's isolate ID in Ruby. ```ruby info = driver.execute_script 'flutter:getVMInfo' # Change the target engine to "info['isolates'][0]['id']" driver.execute_script 'flutter:setIsolateId', info['isolates'][0]['id'] ``` -------------------------------- ### Activate App with Skip Attach Observatory Option Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Example of using the mobile:activateApp command with the skipAttachObservatoryUrl option in Ruby. ```ruby driver.execute_script 'mobile:activateApp', {skipAttachObservatoryUrl: true, appId: 'com.android.chrome'} ``` -------------------------------- ### Client Helper for Assert Visible Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Example of using a client helper method in TypeScript to assert widget visibility by key. ```typescript await assertVisible(driver, { key: 'submit_button' }); ``` -------------------------------- ### Basic Flutter Element Interaction Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/ruby/README.md This snippet demonstrates how to initialize the Appium driver, find a Flutter element by its text, and assert its text content. It also shows how to execute a Flutter-specific script to get the render tree. ```ruby include Appium::Flutter::Finder @driver = ::Appium::Core.for(caps).start_driver # Send a request to an element element = Appium::Flutter::Element.new( @driver, finder: by_text('You have pushed the button this many times:') ) assert element.text == 'You have pushed the button this many times:' # Get render tree by Flutter @driver.execute_script 'flutter:getRenderTree', {} ``` -------------------------------- ### Execute Flutter Command: Get VM Info Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Executes the 'flutter:getVMInfo' command to retrieve information about the Flutter VM. This is a system-level command. ```javascript driver.execute('flutter:getVMInfo') ``` -------------------------------- ### Drag and Drop with Command Extension (Python) Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Performs a drag and drop operation using a command extension. This Python example utilizes the 'flutter:dragAndDropWithCommandExtension' command. ```python driver.execute_script('flutter:dragAndDropWithCommandExtension', payload) ``` -------------------------------- ### Get Current or Particular Isolate in JavaScript Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Demonstrates how to retrieve the current isolate or a specific isolate using its ID in JavaScript. ```javascript driver.execute('flutter:getVMInfo').isolates ``` ```javascript # Get a particular isolate or current isolate # Current isolate: driver.execute('flutter:getIsolate') (JS) # Particular isolate: driver.execute('flutter:getIsolate', 'isolates/2978358234363215') (JS) ``` -------------------------------- ### Get Widget Diagnostics Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Retrieves diagnostic information about a widget and its subtree. Options can be provided to control the depth and properties included in the diagnostics. ```javascript driver.execute('flutter:getRenderObjectDiagnostics', counterTextFinder, { includeProperties: true, subtreeDepth: 2 }) ``` ```javascript driver.execute('flutter:getWidgetDiagnostics', counterTextFinder, { includeProperties: true, subtreeDepth: 2 }) ``` -------------------------------- ### Get Widget Text Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Retrieves the text content of a widget. This command is typically used for widgets that display text, such as Text or RichText. ```javascript driver.getElementText(counterTextFinder) ``` -------------------------------- ### Get Widget Geometry Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Retrieves the geometry (position and size) of a specific widget. These commands require a widget finder as an argument. ```javascript driver.execute('flutter:getBottomLeft', buttonFinder) ``` ```javascript driver.execute('flutter:getBottomRight', buttonFinder) ``` ```javascript driver.execute('flutter:getCenter', buttonFinder) ``` ```javascript driver.execute('flutter:getTopLeft', buttonFinder) ``` ```javascript driver.execute('flutter:getTopRight', buttonFinder) ``` -------------------------------- ### Node.js: Get Text with Command Extension Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Retrieve text from an element in Node.js using the flutter:getTextWithCommandExtension command. It requires importing byValueKey from appium-flutter-finder to locate the element. ```typescript // Extended commands: flutter:getTextWithCommandExtension import {byValueKey} from "appium-flutter-finder"; const payload = { 'findBy': byValueKey('amount'), }; const getTextResult = await driver.execute('flutter:getTextWithCommandExtension', payload); console.log(JSON.stringify(getTextResult)); ``` -------------------------------- ### Get Widget Semantics ID Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Retrieves the semantics ID of a given widget. This is useful for accessibility-related operations. ```javascript driver.execute('flutter:getSemanticsId', counterTextFinder) ``` -------------------------------- ### Python: Get Text with Command Extension Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Retrieve text from an element using its value key. This snippet demonstrates how to find an element by its value key and then execute the flutter:getTextWithCommandExtension command. ```python text_finder = finder.by_value_key('amount') get_text_payload = { 'findBy': text_finder, } result = driver.execute_script('flutter:getTextWithCommandExtension', payload) print(result) ``` -------------------------------- ### Execute Flutter Command: Get Isolate Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Executes the 'flutter:getIsolate' command to retrieve information about a specific isolate, identified by its ID. This is a system-level command. ```javascript driver.execute('flutter:getIsolate', 'isolates/2978358234363215') ``` ```javascript driver.execute('flutter:getIsolate') ``` -------------------------------- ### Run Tests Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/ruby/README.md Execute this command to run the test suite for the project. ```bash rake test ``` -------------------------------- ### Switching to WEBVIEW Context Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Use this command to switch to a WEBVIEW context for testing web content within a hybrid application. Replace 'XXXX' with the appropriate WebView identifier. ```javascript await driver.switchContext("WEBVIEW_XXXX") ``` -------------------------------- ### Upload Release to PyPI Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/python/README.md Create a source distribution of the package and upload it to the Python Package Index using 'twine'. ```shell python setup.py sdist twine upload dist/Appium-Flutter-Finder-X.X.tar.gz ``` -------------------------------- ### Launch App with Arguments and Environment (Ruby) Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Launches the Flutter application with specified arguments and environment variables using Ruby. This command is part of the Flutter Driver interaction. ```ruby driver.execute_script 'flutter:launchApp', 'bundleId', {arguments: ['arg1'], environment: {ENV1: 'env'}} ``` -------------------------------- ### Release Process for Appium Flutter Driver Finder Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/nodejs/README.md Steps to version, commit, tag, and publish the Appium Flutter Driver finder. Ensure you are in the 'finder/nodejs' directory before executing these commands. ```bash cd finder/nodejs npm version git commit -am 'chore: bump version' git tag js-finder- # e.g. git tag js-finder-0.0.23 git push origin js-finder-0.0.23 npm publish ``` -------------------------------- ### Navigate Back Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Use `pageBack` to simulate a back navigation action. This is equivalent to pressing the system's back button. ```javascript pageBack() ``` -------------------------------- ### Add Jitpack Repository to settings.gradle Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/kotlin/README.md Configure your project's settings.gradle file to include the Jitpack repository for dependency resolution. This is necessary to fetch snapshot versions. ```groovy dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { mavenCentral() maven { url 'https://jitpack.io' } } } ``` -------------------------------- ### Switching to NATIVE_APP Context Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Use this command to switch to the NATIVE_APP context for automating native Android or iOS elements. This allows interaction with the underlying native UI elements. ```javascript await driver.switchContext("NATIVE_APP") ``` -------------------------------- ### Initialize Appium Flutter Driver and Interact with Elements Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md This snippet demonstrates how to set up the WebDriverIO client with Appium Flutter Driver capabilities, find elements using `byValueKey`, and perform actions like clicking and asserting text. It includes platform-specific configurations for Android and iOS. ```javascript const wdio = require('webdriverio'); const assert = require('assert'); const { byValueKey } = require('appium-flutter-finder'); const osSpecificOps = process.env.APPIUM_OS === 'android' ? { 'platformName': 'Android', 'appium:deviceName': 'Pixel 2', 'appium:app': __dirname + '/../apps/app-free-debug.apk', }: process.env.APPIUM_OS === 'ios' ? { 'platformName': 'iOS', 'appium:platformVersion': '12.2', 'appium:deviceName': 'iPhone X', 'appium:noReset': true, 'appium:app': __dirname + '/../apps/Runner.zip', } : {}; const opts = { port: 4723, capabilities: { ...osSpecificOps, 'appium:automationName': 'Flutter', 'appium:retryBackoffTime': 500 } }; (async () => { const counterTextFinder = byValueKey('counter'); const buttonFinder = byValueKey('increment'); const driver = await wdio.remote(opts); if (process.env.APPIUM_OS === 'android') { await driver.switchContext('NATIVE_APP'); await (await driver.$('~fab')).click(); await driver.switchContext('FLUTTER'); } else { console.log('Switching context to `NATIVE_APP` is currently only applicable to Android demo app.') } assert.strictEqual(await driver.getElementText(counterTextFinder), '0'); await driver.elementClick(buttonFinder); await driver.touchAction({ action: 'tap', element: { elementId: buttonFinder } }); assert.strictEqual(await driver.getElementText(counterTextFinder), '2'); driver.deleteSession(); })(); ``` -------------------------------- ### Execute Assert Visible with Text Finder in Ruby Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Demonstrates executing the assertVisible command with a text finder and a timeout in Ruby. This is equivalent to using by_text and waitFor. ```ruby driver.execute_script 'flutter:assertVisible', {text: 'Tap me!'}, 10000 ``` ```ruby # This is equivalent to text_finder = by_text 'Tap me!' driver.execute_script 'flutter:assertVisible', text_finder, 10000 # or driver.execute_script 'flutter:waitFor', text_finder, 10000 ``` -------------------------------- ### waitFor Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Waits for a widget to appear on the screen. This command can take a timeout value to specify how long to wait. ```APIDOC ## waitFor ### Description Waits for a widget to appear on the screen. This command can take a timeout value to specify how long to wait. ### Method `driver.execute('flutter:waitFor', buttonFinder, 100)` ### Parameters - **buttonFinder**: Required - The finder for the widget to wait for. - **100**: Optional - The timeout in milliseconds to wait for the widget. ``` -------------------------------- ### Switching to FLUTTER Context Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Use this command to switch to the FLUTTER context for automating Flutter applications. This is necessary to interact with Flutter elements. ```javascript await driver.switchContext("FLUTTER") ``` -------------------------------- ### Release Script for Appium Flutter Driver Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md This script outlines the steps for releasing the appium-flutter-driver package. It includes navigating to the driver directory, running a release script, updating the npm version, committing changes, and tagging the release. ```bash $ cd driver $ sh release.sh $ npm version # update changelog $ git commit -am 'chore: bump version' $ git tag # e.g. git tag v0.0.32 $ git push origin v0.0.32 $ git push origin main ``` -------------------------------- ### Wait For Element Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Waits for a specific element to appear. This command takes the element finder and an optional timeout in milliseconds. ```javascript driver.execute('flutter:waitFor', buttonFinder, 100) ``` -------------------------------- ### Release New Version Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/ruby/README.md Commands to update the version, commit, tag, and release a new version of the gem. ```bash bundle exec rake release ``` -------------------------------- ### waitForTappable Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Waits for a widget to become tappable. This is useful to ensure an element is ready for interaction before attempting to tap it. ```APIDOC ## waitForTappable ### Description Waits for a widget to become tappable. This is useful to ensure an element is ready for interaction before attempting to tap it. ### Method `driver.execute('flutter:waitForTappable', buttonFinder)` ### Parameters - **buttonFinder**: Required - The finder for the widget to wait for until it's tappable. ``` -------------------------------- ### Link Local Driver Source: https://github.com/appium/appium-flutter-driver/blob/main/example/nodejs/README.md Links the local Appium Flutter Driver to be used globally. ```bash npm link ``` -------------------------------- ### Find Widget by ValueKey Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Use `byValueKey` to locate a widget using its unique `ValueKey`. This is a robust way to find elements, especially when other attributes might change. ```javascript byValueKey('counter') ``` -------------------------------- ### waitForAbsent Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Waits for a widget to disappear from the screen. ```APIDOC ## waitForAbsent ### Description Waits for a widget to disappear from the screen. ### Method `driver.execute('flutter:waitForAbsent', buttonFinder)` ### Parameters - **buttonFinder**: Required - The finder for the widget to wait for until it's absent. ``` -------------------------------- ### Find Widget by Text Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Use `byText` to locate a widget that displays specific text. This is useful for finding buttons, labels, or other text-based elements. ```javascript byText('foo') ``` -------------------------------- ### Connect to Observatory WebSocket URL (Ruby) Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Connects to the Flutter Observatory WebSocket URL using Ruby. This command is part of the Flutter Driver interaction. ```ruby driver.execute_script 'flutter:connectObservatoryWsUrl' ``` -------------------------------- ### Python: Drag and Drop with Command Extension Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Use this snippet to perform a drag and drop action on an element using coordinates obtained from flutter:getCenter. Ensure a minimum duration of 15000ms for the drag and drop operation. ```python coord_item_1 = driver.execute_script("flutter:getCenter", item_1) coord_item_2 = driver.execute_script("flutter:getCenter", item_2) start_x = coord_item_1["dx"] start_y = coord_item_1["dy"] end_y = coord_item_2["dy"] payload = { "startX": start_x, "startY": start_y, "endX": "0", "endY": end_y, "duration": "15000" # minimum 15000ms needed to drag n drop } driver.execute_script("flutter:dragAndDropWithCommandExtension", payload) ``` -------------------------------- ### Enable Flutter Driver Extension with Commands Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md This Dart code shows how to enable the Flutter Driver extension, including custom commands like DragCommandExtension and GetTextCommandExtension. ```dart import 'drag_commands.dart'; import 'get_text_command.dart'; void main() { enableFlutterDriverExtension( commands: [DragCommandExtension(), GetTextCommandExtension()]); runApp(const MyApp()); } ``` -------------------------------- ### tap Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Simulates a tap action on a widget. This can be done using element IDs, touch actions, or by executing a click command. ```APIDOC ## tap (elementClick) ### Description Simulates a tap action on a widget using elementClick. ### Method `driver.elementClick(buttonFinder)` ### Parameters - **buttonFinder**: Required - The finder for the element to tap. ``` ```APIDOC ## tap (touchAction) ### Description Simulates a tap action on a widget using touchAction. ### Method `driver.touchAction({action: 'tap', element: {elementId: buttonFinder}})` ### Parameters - **{action: 'tap', element: {elementId: buttonFinder}}**: Required - The touch action details, including the element ID. ``` ```APIDOC ## tap (execute clickElement) ### Description Simulates a tap action on a widget by executing the 'flutter:clickElement' command. ### Method `driver.execute('flutter:clickElement', buttonFinder, {timeout:5000})` ### Parameters - **buttonFinder**: Required - The finder for the element to tap. - **{timeout:5000}**: Optional - The timeout in milliseconds for the click action. ``` -------------------------------- ### screenshot Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Captures a screenshot of the current application view. The screenshot can be taken directly or saved to a specified file path. ```APIDOC ## screenshot (take) ### Description Captures a screenshot of the current application view. ### Method `driver.takeScreenshot()` ``` ```APIDOC ## screenshot (save) ### Description Saves a screenshot of the current application view to a specified file path. ### Method `driver.saveScreenshot('a.png')` ### Parameters - **'a.png'**: Required - The file path where the screenshot will be saved. ``` -------------------------------- ### Scroll Until Tapable Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Scrolls a widget until it is tapable. This command supports specifying scroll offsets and an optional wait timeout in milliseconds. ```javascript driver.execute('flutter:scrollUntilTapable', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400}); ``` ```javascript driver.execute('flutter:scrollUntilTapable', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400, waitTimeoutMilliseconds: 20000}); ``` -------------------------------- ### Assert Visible Widget by Key Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Use this command to assert that a widget with a specific key is visible. This is a shortcut command provided by the appium-flutter-driver. ```javascript driver.execute('flutter:assertVisible', { key: 'myKey' }) ``` -------------------------------- ### Wait For Tappable Element Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Waits for a specific element to become tappable. This command takes the element finder. ```javascript driver.execute('flutter:waitForTappable', buttonFinder) ``` -------------------------------- ### Find Widget by Tooltip Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Use `byTooltip` to locate a widget that has a specific tooltip. This is useful for elements that might not have a unique text or type. ```javascript byTooltip('Increment') ``` -------------------------------- ### Connect to Flutter Driver Session Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Establishes a connection to the Flutter Driver session using webdriverio. This is the initial step to interact with the Flutter application. ```javascript const opts = { path: '/wd/hub', port: 4723, capabilities: { platformName: 'Android', deviceName: 'Android Emulator', appPackage: 'com.example.flutter_app', appActivity: 'MainActivity', automationName: 'UiAutomator2', // Use the flutter driver driver: 'flutter', }, }; const driver = await wdio.remote(opts); ``` -------------------------------- ### scrollIntoView Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Scrolls a widget until it is visible within the viewport. This command supports specifying an alignment and an optional timeout. ```APIDOC ## scrollIntoView ### Description Scrolls a widget until it is visible within the viewport. This command supports specifying an alignment and an optional timeout. ### Method `driver.execute('flutter:scrollIntoView', find.byType('TextField'), {alignment: 0.1})` ### Parameters - **find.byType('TextField')**: Required - The widget to scroll into view. - **{alignment: 0.1}**: Required - The alignment of the widget within the viewport. ### Method `driver.execute('flutter:scrollIntoView', find.byType('TextField'), {alignment: 0.1, timeout: 30000})` ### Parameters - **find.byType('TextField')**: Required - The widget to scroll into view. - **{alignment: 0.1, timeout: 30000}**: Required - The alignment of the widget and an optional timeout in milliseconds. ``` -------------------------------- ### Enable Flutter Driver Extension in main.dart Source: https://github.com/appium/appium-flutter-driver/blob/main/example/sample2/README.md Add this line to your Flutter app's main.dart file to enable the Flutter Driver extension. This is necessary for Appium to interact with your Flutter application during testing. ```diff --- a/add_to_app/fullscreen/flutter_module/lib/main.dart +++ b/add_to_app/fullscreen/flutter_module/lib/main.dart import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; +import 'package:flutter_driver/driver_extension. + +/// The entrypoint for the flutter module. +void main() { + + // for testing example + enableFlutterDriverExtension(); + // This call ensures the Flutter binding has been set up before creating the // MethodChannel-based model. ``` -------------------------------- ### Scroll Into View Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Scrolls a specific widget into view. This command can optionally include a timeout in milliseconds for the scroll operation. ```javascript driver.execute('flutter:scrollIntoView', find.byType('TextField'), {alignment: 0.1}) ``` ```javascript driver.execute('flutter:scrollIntoView', find.byType('TextField'), {alignment: 0.1, timeout: 30000}) ``` -------------------------------- ### Enter Text into Text Field Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Enters text into a specified text field. This command can be used with or without prior focus on the text field. ```javascript driver.elementSendKeys(find.byType('TextField'), 'I can enter text') ``` ```javascript driver.elementClick(find.byType('TextField')); driver.execute('flutter:enterText', 'I can enter text') ``` -------------------------------- ### Scroll Until Visible Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Scrolls a widget until it is visible. This command supports specifying scroll offsets and an optional wait timeout in milliseconds. ```javascript driver.execute('flutter:scrollUntilVisible', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400}); ``` ```javascript driver.execute('flutter:scrollUntilVisible', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400, waitTimeoutMilliseconds: 20000}); ``` -------------------------------- ### Add Gem to Gemfile Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/ruby/README.md Include this line in your application's Gemfile to add the AppiumFlutterFinder gem. ```ruby gem 'appium_flutter_finder' ``` -------------------------------- ### Assert Not Visible Widget by Key Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Use this command to assert that a widget with a specific key is not visible. This is a shortcut command provided by the appium-flutter-driver. ```javascript driver.execute('flutter:assertNotVisible', { key: 'hiddenWidget' }) ``` -------------------------------- ### Assert Tappable Widget by Label Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Use this command to assert that a widget with a specific tooltip label is tappable. This is a shortcut command provided by the appium-flutter-driver. ```javascript driver.execute('flutter:assertTappable', { label: 'Submit' }) ``` -------------------------------- ### Find Widget by Type Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Use `byType` to locate a widget based on its class name. This is helpful when you know the specific type of widget you are looking for. ```javascript byType('TextField') ``` -------------------------------- ### setTextEntryEmulation Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Enables or disables text entry emulation for the driver. This can be useful for controlling how text input is handled. ```APIDOC ## setTextEntryEmulation ### Description Enables or disables text entry emulation for the driver. This can be useful for controlling how text input is handled. ### Method `driver.execute('flutter:setTextEntryEmulation', false)` ### Parameters - **false**: Required - Specifies whether to enable (true) or disable (false) text entry emulation. ``` -------------------------------- ### scrollUntilTapable Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Scrolls a widget until it is tapable or a specified timeout is reached. This command is similar to scrollUntilVisible but targets tapable elements. ```APIDOC ## scrollUntilTapable ### Description Scrolls a widget until it is tapable or a specified timeout is reached. This command is similar to scrollUntilVisible but targets tapable elements. ### Method `driver.execute('flutter:scrollUntilTapable', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400});` ### Parameters - **find.byType('ListView')**: Required - The scrollable widget. - **{item:find.byType('TextField'), dxScroll: 90, dyScroll: -400}**: Required - The item to find and scroll parameters. ### Method `driver.execute('flutter:scrollUntilTapable', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400, waitTimeoutMilliseconds: 20000});` ### Parameters - **find.byType('ListView')**: Required - The scrollable widget. - **{item:find.byType('TextField'), dxScroll: 90, dyScroll: -400, waitTimeoutMilliseconds: 20000}**: Required - The item to find, scroll parameters, and wait timeout in milliseconds. ``` -------------------------------- ### Assert Visible Widget by Text Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Use this command to assert that a widget containing specific text is visible. This is a shortcut command provided by the appium-flutter-driver. ```javascript driver.execute('flutter:assertVisible', { text: 'Login' }) ``` -------------------------------- ### Execute Flutter Command: Wait For First Frame Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Executes the 'flutter:waitForFirstFrame' command to pause execution until the first frame of the Flutter application is rendered. This is useful for synchronizing tests with UI rendering. ```javascript driver.execute('flutter:waitForFirstFrame') ``` -------------------------------- ### Wait For Absent Element Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Waits for a specific element to disappear from the screen. This command takes the element finder. ```javascript driver.execute('flutter:waitForAbsent', buttonFinder) ``` -------------------------------- ### Take Screenshot Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Captures a screenshot of the current Flutter application state. The screenshot can be taken without arguments or saved to a specified file path. ```javascript driver.takeScreenshot() ``` ```javascript driver.saveScreenshot('a.png') ``` -------------------------------- ### Add AppiumFlutterDriver Snapshot Dependency Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/kotlin/README.md Include the AppiumFlutterDriver snapshot dependency in your Gradle build file for testing purposes. This allows you to use the latest development version. ```groovy dependencies { testImplementation 'com.github.appium:appium-flutter-driver:main-SNAPSHOT' } ``` -------------------------------- ### scroll Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Scrolls a widget within the application. This command allows for specifying scroll offsets, duration, and frequency. ```APIDOC ## scroll ### Description Scrolls a widget within the application. This command allows for specifying scroll offsets, duration, and frequency. ### Method `driver.execute('flutter:scroll', find.byType('ListView'), {dx: 50, dy: -100, durationMilliseconds: 200, frequency: 30})` ### Parameters - **find.byType('ListView')**: Required - The widget to scroll. - **{dx: 50, dy: -100, durationMilliseconds: 200, frequency: 30}**: Required - Scroll offset and timing parameters. ``` -------------------------------- ### Set Text Entry Emulation Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Enables or disables text entry emulation for the Flutter driver. Set to false to disable. ```javascript driver.execute('flutter:setTextEntryEmulation', false) ``` -------------------------------- ### Execute Flutter Session Commands Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Executes session-level commands for the Flutter Driver. These commands interact with the overall session rather than specific widgets. ```javascript driver.execute('flutter:checkHealth') ``` ```javascript driver.execute('flutter:clearTimeline') ``` ```javascript driver.execute('flutter:forceGC') ``` ```javascript driver.execute('flutter: getRenderTree') ``` -------------------------------- ### scrollUntilVisible Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Scrolls a widget until it is visible or a specified timeout is reached. This command allows for detailed control over scroll direction and distance. ```APIDOC ## scrollUntilVisible ### Description Scrolls a widget until it is visible or a specified timeout is reached. This command allows for detailed control over scroll direction and distance. ### Method `driver.execute('flutter:scrollUntilVisible', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400});` ### Parameters - **find.byType('ListView')**: Required - The scrollable widget. - **{item:find.byType('TextField'), dxScroll: 90, dyScroll: -400}**: Required - The item to find and scroll parameters. ### Method `driver.execute('flutter:scrollUntilVisible', find.byType('ListView'), {item:find.byType('TextField'), dxScroll: 90, dyScroll: -400, waitTimeoutMilliseconds: 20000});` ### Parameters - **find.byType('ListView')**: Required - The scrollable widget. - **{item:find.byType('TextField'), dxScroll: 90, dyScroll: -400, waitTimeoutMilliseconds: 20000}**: Required - The item to find, scroll parameters, and wait timeout in milliseconds. ``` -------------------------------- ### Skip iOS Doctor Check Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Runs the Appium driver doctor command for Flutter while skipping the iOS-specific checks. ```bash # skip iOS check SKIP_IOS=1 appium driver doctor flutter ``` -------------------------------- ### Skip Android Doctor Check Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Runs the Appium driver doctor command for Flutter while skipping the Android-specific checks. ```bash # skip Android check SKIP_ANDROID=1 appium driver doctor flutter ``` -------------------------------- ### Flutter pubspec.yaml Dependency Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Specifies the flutter_driver dependency in your Flutter project's pubspec.yaml file. This is required for the driver to interact with your application. ```yaml dev_dependencies: flutter_driver: sdk: flutter ``` -------------------------------- ### Request Data with Deep Link Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Requests data from the Flutter application, often used in conjunction with deep linking. The data payload should be a JSON string. ```javascript driver.execute('flutter:requestData', json.dumps({"deepLink": "myapp://item/id1"})) ``` -------------------------------- ### Tap Widget Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Performs a tap action on a widget. This can be done using elementClick, touchAction, or the execute command with 'flutter:clickElement'. ```javascript driver.elementClick(buttonFinder) ``` ```javascript driver.touchAction({action: 'tap', element: {elementId: buttonFinder}}) ``` ```javascript driver.execute('flutter:clickElement', buttonFinder, {timeout:5000}) ``` -------------------------------- ### setFrameSync Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Controls frame synchronization for the Flutter driver. It can be enabled or disabled, and a duration can be specified for synchronization. ```APIDOC ## setFrameSync ### Description Controls frame synchronization for the Flutter driver. It can be enabled or disabled, and a duration can be specified for synchronization. ### Method `driver.execute('flutter:setFrameSync', bool , durationMilliseconds)` ### Parameters - **bool**: Required - Specifies whether to enable or disable frame synchronization. - **durationMilliseconds**: Optional - The duration in milliseconds for frame synchronization. ``` -------------------------------- ### Add AppiumFlutterDriver Specific Version Dependency Source: https://github.com/appium/appium-flutter-driver/blob/main/finder/kotlin/README.md Add a specific version of the AppiumFlutterDriver library to your Gradle dependencies. This is useful for ensuring stability by using a released version. ```groovy dependencies { testImplementation 'com.github.appium:appium-flutter-driver:kotlin-finder-0.0.7' } ``` -------------------------------- ### Set Frame Sync Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Controls frame synchronization for the Flutter driver. Use this to enable or disable frame sync and specify a duration in milliseconds. ```javascript driver.execute('flutter:setFrameSync', bool , durationMilliseconds) ``` -------------------------------- ### Scroll Widget Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Scrolls a widget within the Flutter application. This command allows specifying the scrollable widget and the scroll offset with duration and frequency. ```javascript driver.execute('flutter:scroll', find.byType('ListView'), {dx: 50, dy: -100, durationMilliseconds: 200, frequency: 30}) ``` -------------------------------- ### Execute Flutter Command: Long Tap Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Executes the 'flutter:longTap' command to perform a long tap gesture on a widget. This command requires a finder and can specify duration and frequency. ```javascript driver.execute('flutter:longTap', find.byValueKey('increment'), {durationMilliseconds: 10000, frequency: 30}) ``` -------------------------------- ### Clear Text Field Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Clears the text content of a specified text field. This command targets a TextField widget identified by its type. ```javascript driver.elementClear(find.byType('TextField')) ``` -------------------------------- ### Execute Flutter Command: Set Isolate ID Source: https://github.com/appium/appium-flutter-driver/blob/main/README.md Executes the 'flutter:setIsolateId' command to set the target isolate ID for subsequent commands. This is a system-level command. ```javascript driver.execute('flutter:setIsolateId', 'isolates/2978358234363215') ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.