### Install AppiumLibrary using pip Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/README.rst Recommended installation method for AppiumLibrary using pip. Ensure you have Python and pip installed. ```bash pip install --upgrade robotframework-appiumlibrary ``` -------------------------------- ### Install AppiumLibrary from GitHub Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/README.rst Alternative installation method directly from the GitHub repository's master branch using pip. ```bash pip install git+https://github.com/serhatbolsu/robotframework-appiumlibrary.git ``` -------------------------------- ### Start Activity Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Starts the given activity intent. It invokes the `am start/ am start-activity` command under the hood. This keyword extends the functionality of the Start Activity app management API. The intent is built with the `appPackage` and `appActivity`. ```APIDOC ## Start Activity ### Description Starts the given activity intent using `am start/ am start-activity` command. ### Method N/A (Keyword) ### Endpoint N/A (Keyword) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ``` Start Activity com.google.android.deskclock com.android.deskclock.DeskClock ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Install App Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Installs the application via Appium. This is an Android-only feature. ```APIDOC ## Install App ### Description Installs the app via appium. ### Method Not specified (likely a keyword execution in Robot Framework) ### Endpoint Not applicable (keyword-based) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```robotframework Install App /path/to/my.apk com.example.myapp ``` ### Response #### Success Response (200) None specified #### Response Example None specified ``` -------------------------------- ### Start Screen Recording Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Starts an asynchronous Screen Recording for the current open application. Used in conjunction with Stop Screen Recording. ```APIDOC ## Start Screen Recording ### Description Starts an asynchronous screen recording for the current application. This keyword is used hand-in-hand with `Stop Screen Recording`. ### Method N/A (Keyword) ### Endpoint N/A (Keyword) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ``` Start Screen Recording ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Get Webelements Example Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Returns a list of WebElement objects matching the locator. Useful for interacting with multiple elements of the same type. ```robotframework *** Test Cases *** Work With Multiple Elements @{elements}= Get Webelements class=android.widget.TextView ${count}= Get Length ${elements} Log Found ${count} text views # Click the third element Click Element @{elements}[2] ``` -------------------------------- ### Get Windows Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Returns the available Webview windows. ```robotframework Get Windows ``` -------------------------------- ### Install App (Android) Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Installs an Android application package (APK) onto the device and returns a boolean indicating success. Requires the path to the APK file. ```robotframework *** Test Cases *** Install Application ${installed}= Install App /path/to/app.apk com.example.app Should Be True ${installed} ``` -------------------------------- ### Using WebElements for Clicks Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Instead of locators, you can pass WebElement objects obtained from 'Get Webelements' or 'Get WebElement' keywords. This example clicks the third button found. ```robotframework @{elements} Get Webelements class=UIAButton Click Element @{elements}[2] ``` -------------------------------- ### Setup Mustache Parameters Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Sets up parameters for a Mustache template, including programs and hash. ```javascript setupFullMustacheParams: function(e, t, r, n) { var o = e.params; return this.pushParams(o), this.opcode("pushProgram", t), this.opcode("pushProgram", r), e.hash ? this.accept(e.hash) : this.opcode("emptyHash", n), o } ``` -------------------------------- ### Get Webelement Example Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Returns a WebElement object for advanced interactions. This allows for calling methods directly on the element object. ```robotframework *** Test Cases *** Work With WebElement ${element}= Get Webelement id=my_element Click Element ${element} ${button}= Get Webelement xpath=//android.widget.Button[@text='Submit'] ${is_enabled}= Call Method ${button} is_enabled Should Be True ${is_enabled} ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/README.rst Install necessary development dependencies using pip. This includes requirements for testing and development, as well as the library itself in editable mode. ```bash pip install -r test_require.txt pip install -r dev_requirements.txt pip install -e . ``` -------------------------------- ### Start Activity (Android) Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Launches a specific Android activity, optionally with intent actions, URIs, and other parameters. Used for starting new screens or deep linking. ```robotframework *** Test Cases *** Start Activity Examples # Basic activity start Start Activity com.android.settings .Settings # With additional options Start Activity com.google.android.apps.maps com.google.android.maps.MapsActivity ... action=android.intent.action.VIEW ... uri=geo:37.7749,-122.4194 # Clock app example Start Activity com.google.android.deskclock com.android.deskclock.DeskClock ``` -------------------------------- ### Get Element Size Example Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Returns the width and height of an element. The dimensions are returned in a dictionary format. ```robotframework *** Test Cases *** Get Element Dimensions ${size}= Get Element Size id=image_view Log Element size: ${size['width']}x${size['height']} ``` -------------------------------- ### Start Activity Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Starts a given activity intent on Android devices. This keyword extends the functionality of the Start Activity app management API. ```APIDOC ## Start Activity ### Description Starts the given activity intent. It invokes the `am start/ am start-activity` command under the hood. This keyword extends the functionality of the Start Activity app management API. The intent is built with the `appPackage` and `appActivity`. **Android only.** ### Method POST ### Endpoint /session/{sessionid}/appium/device/start_activity ### Parameters #### Request Body - **appPackage** (string) - Required - Package of install app to verify. - **appActivity** (string) - Required - Activity that should be launched. - **user** (string) - Optional - The user ID for which the service is started. - **wait** (boolean) - Optional - Set to true to block the method call until the Activity Manager's process returns control. - **stop** (boolean) - Optional - Set to true to force stop the target app before starting the activity. - **windowingMode** (string) - Optional - The windowing mode to launch the activity into. - **activityType** (string) - Optional - The activity type to launch the activity as. - **action** (string) - Optional - Action name for the Activity Manager's `-a` argument. - **uri** (string) - Optional - Unified resource identifier for the Activity Manager's `-d` argument. - **mimeType** (string) - Optional - The actual value for the Activity Manager's `-t` argument. - **identifier** (string) - Optional - Optional identifier for the Activity Manager's `-i` argument. - **categories** (array of strings) - Optional - One or more category names for the Activity Manager's `-c` argument. - **component** (string) - Optional - Component name for the Activity Manager's `-n` argument. - **package** (string) - Optional - Package name for the Activity Manager's `-p` argument. - **extras** (array of arrays) - Optional - Optional intent arguments, represented as an array of arrays, where each subarray item contains two or three string items: value type, key and the value itself. - **flags** (string) - Optional - Intent startup-specific flags as a hexadecimal string. ### Request Example ```json { "appPackage": "com.example.app", "appActivity": ".MainActivity", "wait": true, "extras": [ ["string", "key1", "value1"], ["int", "key2", "123"] ] } ``` ### Response #### Success Response (200) - **value** (boolean) - Indicates if the activity was started successfully. #### Response Example ```json { "value": true } ``` ``` -------------------------------- ### Clone Repository Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/README.rst Clone your fork of the repository to start development. Ensure you are in the cloned directory. ```bash git clone https://github.com/YOUR_USERNAME/robotframework-appiumlibrary.git cd robotframework-appiumlibrary ``` -------------------------------- ### Go To Url Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Opens the specified URL in the default web browser. Requires initial setup with Open Application. ```robotframework Open Application http://localhost:4755/wd/hub platformName=iOS platformVersion=7.0 deviceName='iPhone Simulator' browserName=Safari ``` ```robotframework Go To Url http://www.example.com ``` -------------------------------- ### Get Element Location Example Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Returns the x,y coordinates of an element on the screen. The coordinates are returned in a dictionary format. ```robotframework *** Test Cases *** Get Element Position ${location}= Get Element Location id=floating_button Log Element is at x=${location['x']}, y=${location['y']} ``` -------------------------------- ### Start Screen Recording Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Start Screen Recording initiates a screen recording session on the device. Various options are available to control recording duration, bitrate, video size, and quality for both Android and iOS. ```robotframework Start Screen Recording timeLimit=180s ``` ```robotframework # Android with options Start Screen Recording timeLimit=60s bitRate=4000000 videoSize=1280x720 ``` ```robotframework # iOS with options Start Screen Recording timeLimit=300s videoQuality=high videoFps=30 ``` -------------------------------- ### Start Android Activity Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Starts a specific Android activity. This keyword is useful for launching applications or specific screens within an application. It internally uses the 'am start' or 'am start-activity' command. ```robotframework Start Activity com.google.android.deskclock com.android.deskclock.DeskClock ``` -------------------------------- ### Get Text Examples Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Returns the text content of an element. Can retrieve text from a single element or multiple elements when `first_only` is set to False. ```robotframework *** Test Cases *** Verify Element Text ${text}= Get Text id=welcome_message Should Be Equal ${text} Welcome, User! Get Multiple Texts @{texts}= Get Text xpath=//*[contains(@text,'item')] first_only=${False} Length Should Be ${texts} 5 ``` -------------------------------- ### Tap with Positions Example Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Demonstrates tapping on specific locations with multiple fingers for a set duration. Requires creating lists for finger positions and then calling the keyword. ```robotframework @{firstFinger} create list ${100} ${500} @{secondFinger} create list ${700} ${500} @{fingerPositions} create list ${firstFinger} ${secondFinger} Sleep 1 Tap with Positions 300ms @{fingerPositions} ``` -------------------------------- ### Switch To Frame Example Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Switches focus to a specified frame by index, name, or webelement. The example demonstrates navigating to a URL, switching to a frame named 'iframe_name', and then clicking an element within that frame. ```robotframework Go To Url http://www.xxx.com Switch To Frame iframe_name Click Element xpath=//\*[@id='online-btn'] ``` -------------------------------- ### Get Contexts Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Retrieves a list of all available contexts for the current session. ```APIDOC ## GET CONTEXTS ### Description Returns the available contexts. ### Method N/A (Keyword) ### Endpoint N/A (Keyword) ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **contexts** (list) - A list of available context names. #### Response Example N/A ``` -------------------------------- ### Rebuild Keyword Documentation Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/BUILD.rst Use this command to rebuild the keyword documentation for AppiumLibrary. Ensure you have the necessary tools installed. ```bash libdoc AppiumLibrary docs/AppiumLibrary.html ``` -------------------------------- ### Setup Wildcards Regular Expression Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Prepares the input string for wildcard processing by replacing specific wildcard characters with temporary placeholders. ```javascript setupWildcardsRegExp: function(e){return(e=e.replace(/(?:\\)*\?/g,function(e){return"\\\\"===e.charAt(0)? ``` -------------------------------- ### Page Should Contain Text Examples Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Verifies that specific text is present on the current page. An optional log level can be specified. ```robotframework *** Test Cases *** Verify Page Content Page Should Contain Text Welcome to the App Page Should Contain Text Login successful loglevel=DEBUG ``` -------------------------------- ### Locator Strategies Reference Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Complete reference for all supported locator strategies with examples. These strategies are used to identify elements on the screen for interaction. ```robotframework *** Test Cases *** All Locator Strategy Examples # ID - matches @resource-id (Android) or accessibility identifier (iOS) Click Element id=login_button # Identifier - matches @id or @name attributes Click Element identifier=my_element # Name - matches @name attribute (Selendroid only) Click Element name=submit_btn # XPath - full XPath expression (auto-detected if starts with //) Click Element xpath=//android.widget.Button[@text='Login'] Click Element //android.widget.Button[@text='Login'] # Class - matches by class name Click Element class=android.widget.EditText # Accessibility ID - matches accessibility identifier Click Element accessibility_id=login_button # Android UI Automator Click Element android=UiSelector().text("Login") Click Element android=UiSelector().resourceId("com.app:id/btn").className("android.widget.Button") Click Element android=UiSelector().description("Submit button") # iOS UI Automation (deprecated) Click Element ios=.buttons()["Login"] # iOS Predicate String Click Element predicate=name == "Login" AND type == "XCUIElementTypeButton" Click Element predicate=label CONTAINS "Welcome" Click Element predicate=value BEGINSWITH "Hello" # iOS Class Chain Click Element chain=**/XCUIElementTypeButton[`label == "Login"`] Click Element chain=**/XCUIElementTypeCell[`name CONTAINS "item"`]/XCUIElementTypeButton # CSS Selector (webview only) Click Element css=button.submit-btn Click Element css=#login-form input[type="submit"] ``` -------------------------------- ### Get Current or All Contexts Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Returns the current context (e.g., NATIVE_APP, WEBVIEW) or a list of all available contexts. ```robotframework *** Test Cases *** Work With Contexts ${current}= Get Current Context Log Current context: ${current} @{contexts}= Get Contexts Log Available contexts: @{contexts} ``` -------------------------------- ### Get Page Source Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Returns the entire source XML of the current mobile application page. ```robotframework ${source} Get Source ``` -------------------------------- ### Get Page Source Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Returns the entire page source XML or HTML of the current view. ```robotframework *** Test Cases *** Analyze Page Source ${source}= Get Source Should Contain ${source} android.widget.Button Log ${source} ``` -------------------------------- ### Open Application with W3C Capabilities Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/CONTRIBUTING.rst Demonstrates how to use the `Open Application` keyword with W3C-style capabilities, including those prefixed with `appium:`. This is relevant when encountering issues with capability forwarding to the Appium server. ```robotframework *** Test Cases *** Example Open Application http://127.0.0.1:4723 ... platformName=Android ... appium:automationName=UIAutomator2 ... appium:app=/path/to/app.apk ``` -------------------------------- ### Open Application and Switch Application Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Opens multiple application instances and demonstrates switching between them using index or alias. Returns the index of the previous active application. ```robotframework ${appium1}= Open Application http://localhost:4723/wd/hub alias=MyApp1 platformName=iOS platformVersion=7.0 deviceName='iPhone Simulator' app=your.app ``` ```robotframework ${appium2}= Open Application http://localhost:4755/wd/hub alias=MyApp2 platformName=iOS platformVersion=7.0 deviceName='iPhone Simulator' app=your.app ``` ```robotframework Switch Application ${appium1} # Switch using index ``` ```robotframework Switch Application MyApp2 # Switch using alias ``` -------------------------------- ### Build Release Files Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/BUILD.rst Clean the 'dist/' folder and build the release files using the 'build' package. Verify the contents of the 'dist/' folder afterwards. ```bash # clean dist/ folder rm -Rf dist # build release files python -m build # verify ls dist ``` -------------------------------- ### Get Element Attribute Example Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Returns the value of a specific attribute from an element. Use to retrieve properties like name, text, enabled status, or class name. ```robotframework *** Test Cases *** Get Element Attributes ${name}= Get Element Attribute id=my_button name ${text}= Get Element Attribute id=my_button text ${enabled}= Get Element Attribute id=my_button enabled ${class}= Get Element Attribute id=my_button className Should Be Equal ${enabled} true ``` -------------------------------- ### Get Device Location Example Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Retrieves the device's current GPS location and address information. Requires location services to be enabled, app permissions granted, and an internet connection for address lookup. Uses OpenStreetMap's Nominatim service. ```robotframework ${location}= Get Device Location Log Current location: ${location['city']}, ${location['country']} Should Not Be Empty ${location['latitude']} Should Be True ${location['longitude']} != 0 ``` -------------------------------- ### Prepare Path (Absolute) Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Prepares an absolute path. ```javascript case 42:this.$=n.preparePath(!0,i[s],this._$);break; ``` -------------------------------- ### Open Application With Options Dictionary Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Opens an application session using a dictionary of Appium capabilities, useful for complex configurations. ```robotframework *** Test Cases *** Open Application With Options Dictionary Open Application ${REMOTE_URL} platformName=iOS appium:options=&{APPIUM_OPTIONS} ``` -------------------------------- ### Page Should Contain Element Example Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Verifies that a specific element is present on the page, identified by a locator. Use for checking the existence of UI components. ```robotframework *** Test Cases *** Verify Elements Present Page Should Contain Element id=login_button Page Should Contain Element xpath=//android.widget.TextView[@text='Home'] ``` -------------------------------- ### Start Screen Recording Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Initiates an asynchronous screen recording for the current application. Configure recording duration and quality using optional arguments. This keyword is used in conjunction with 'Stop Screen Recording'. ```robotframework Start Screen Recording # starts a screen record session ``` -------------------------------- ### Prepare Path (Relative) Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Prepares a relative path. ```javascript case 43:this.$=n.preparePath(!1,i[s],this._$);break; ``` -------------------------------- ### Robot Framework Test Suite with AppiumLibrary Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/README.rst Example Robot Framework test suite demonstrating the import and basic usage of AppiumLibrary keywords for mobile application testing. Requires Appium server to be running. ```robotframework *** Settings *** Documentation Simple example using AppiumLibrary Library AppiumLibrary *** Variables *** ${ANDROID_AUTOMATION_NAME} UIAutomator2 ${ANDROID_APP} ${CURDIR}/demoapp/ApiDemos-debug.apk ${ANDROID_PLATFORM_NAME} Android ${ANDROID_PLATFORM_VERSION} %{ANDROID_PLATFORM_VERSION=11} *** Test Cases *** Should send keys to search box and then check the value Open Test Application Input Search Query Hello World! Submit Search Search Query Should Be Matching Hello World! *** Keywords *** Open Test Application Open Application http://127.0.0.1:4723/wd/hub automationName=${ANDROID_AUTOMATION_NAME} ... platformName=${ANDROID_PLATFORM_NAME} platformVersion=${ANDROID_PLATFORM_VERSION} ... app=${ANDROID_APP} appPackage=io.appium.android.apis appActivity=.app.SearchInvoke Input Search Query [Arguments] ${query} Input Text txt_query_prefill ${query} Submit Search Click Element btn_start_search Search Query Should Be Matching [Arguments] ${text} Wait Until Page Contains Element android:id/search_src_text Element Text Should Be android:id/search_src_text ${text} ``` -------------------------------- ### Initialize Appium Library Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Initializes the Appium Library with desired capabilities and options. Ensure to set up your Appium server and desired capabilities before using this keyword. ```robotframework *** Settings *** Library AppiumLibrary *** Variables *** ${REMOTE_URL} http://localhost:4723 ${PLATFORM_NAME} Android ${PLATFORM_VERSION} 10.0 ${DEVICE_NAME} Android Emulator ${APP_PACKAGE} com.example.app ${APP_ACTIVITY} .MainActivity *** Test Cases *** Open Application Test Open Application ${REMOTE_URL} platformName=${PLATFORM_NAME} platformVersion=${PLATFORM_VERSION} deviceName=${DEVICE_NAME} appPackage=${APP_PACKAGE} appActivity=${APP_ACTIVITY} ``` -------------------------------- ### Get Window Width / Get Window Height Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Retrieves the device screen's width and height in pixels. Useful for calculating screen positions or validating layout. ```robotframework *** Test Cases *** Get Screen Dimensions ${width}= Get Window Width ${height}= Get Window Height Log Screen size: ${width}x${height} # Calculate center point ${center_x}= Evaluate ${width} / 2 ${center_y}= Evaluate ${height} / 2 ``` -------------------------------- ### Deploy to PyPI Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/BUILD.rst Upload the built release files to the Python Package Index (PyPI) using the 'twine' utility. ```bash twine upload dist/* ``` -------------------------------- ### Get Device Location Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Retrieves the device's current GPS location and performs reverse geocoding to get address details. Returns a dictionary with country, state, city, latitude, and longitude. ```robotframework *** Test Cases *** Get Location Info ${location}= Get Device Location Log Country: ${location['country']} Log State: ${location['state']} Log City: ${location['city']} Log Coordinates: ${location['latitude']}, ${location['longitude']} ``` -------------------------------- ### Open Application Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Opens a new application to the given Appium server. It now uses ClientConfig for configuration. Refer to the Selenium ClientConfig documentation for more details. ```APIDOC ## Open Application ### Description Opens a new application to the given Appium server. Capabilities of appium server, Android and iOS. ### Method POST ### Endpoint /wd/hub/session ### Parameters #### Query Parameters - **remote_url** (string) - Required - Appium server url - **alias** (string) - Optional - alias ### Request Example ```json { "desiredCapabilities": { "platformName": "Android", "appium:deviceName": "Android Emulator", "appium:platformVersion": "11", "appium:automationName": "UiAutomator2", "appium:app": "/path/to/your/app.apk" } } ``` ### Response #### Success Response (200) - **sessionId** (string) - The session ID of the opened application. - **capabilities** (object) - The capabilities of the Appium server and device. ``` -------------------------------- ### Create and Activate Virtual Environment Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/README.rst Create a Python virtual environment for isolated development and activate it. The activation command differs between operating systems. ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` -------------------------------- ### Get Capability Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Retrieves the value of a specific Appium capability. ```APIDOC ## GET CAPABILITY ### Description Returns the desired capability value by ``capability_name``. ### Method N/A (Keyword) ### Endpoint N/A (Keyword) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **capability_value** (any) - The value of the requested capability. #### Response Example N/A ### Keyword Arguments - **capability_name** (string) - Required - The name of the capability to retrieve. ``` -------------------------------- ### Import AppiumLibrary Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Imports the AppiumLibrary with optional configuration for timeout, failure handling, and wait loop settings. ```robotframework *** Settings *** Library AppiumLibrary ``` ```robotframework *** Settings *** Library AppiumLibrary timeout=10 ``` ```robotframework *** Settings *** Library AppiumLibrary timeout=10 run_on_failure=No Operation ``` ```robotframework *** Settings *** Library AppiumLibrary timeout=10 sleep_between_wait_loop=0.3 ``` -------------------------------- ### Get Window Url Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Returns the current Webview window URL. ```robotframework Get Window Url ``` -------------------------------- ### Go To URL Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Opens a specified URL in the mobile browser or webview. Ensure the application is open and the correct context is selected. ```robotframework *** Test Cases *** Navigate To URL Open Application http://localhost:4723 platformName=iOS browserName=Safari ... Go To URL https://www.example.com Page Should Contain Text Example Domain ``` -------------------------------- ### Get Window Title Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Returns the current Webview window title. ```robotframework Get Window Title ``` -------------------------------- ### Generate Keyword Documentation Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/CONTRIBUTING.rst Use this command to regenerate the keyword documentation for the AppiumLibrary. Ensure you are in the correct directory. ```bash python -m robot.libdoc ./AppiumLibrary/ ./docs/AppiumLibrary.html ``` -------------------------------- ### Get Text Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Returns the text content of an element identified by a locator. ```APIDOC ## GET /element/text ### Description Returns the text of the element with the locator. Args: Examples:
${text} Get Text //*[contains(@text,'foo')]
@{text} Get Text //*[contains(@text,'foo')] ${False}
### Method GET ### Endpoint /element/text ### Parameters #### Query Parameters - **locator** (string) - Required - The locator for the element. - **first_only** (boolean) - Optional - Defaults to True. If False, returns text from all matches. ### Response #### Success Response (200) - **text** (string or array of strings) - The text content of the element(s). #### Response Example ```json { "text": "Example Text" } ``` ```json { "text": ["Text 1", "Text 2"] } ``` ``` -------------------------------- ### Get Source Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Retrieves the entire source XML/HTML of the current page. ```APIDOC ## GET /source ### Description Returns the entire source of the current page. ### Method GET ### Endpoint /source ### Response #### Success Response (200) - **source** (string) - The source XML/HTML of the current page. #### Response Example ```json { "source": "..." } ``` ``` -------------------------------- ### Open Application With SSL Options Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Opens an application session with specific SSL options, such as ignoring certificates. ```robotframework *** Test Cases *** Open Application With SSL Options Open Application ${REMOTE_URL} alias=SecureApp platformName=Android ignore_certificates=False ``` -------------------------------- ### Get Element Size Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Returns the size of the element identified by the locator. ```APIDOC ## GET /element/size ### Description Returns the size of the element with the locator. Key attributes for arbitrary elements are id and name. See introduction for details about locating elements. ### Method GET ### Endpoint /element/size ### Parameters #### Query Parameters - **locator** (string) - Required - The locator for the element. ### Response #### Success Response (200) - **width** (integer) - The width of the element. - **height** (integer) - The height of the element. #### Response Example ```json { "width": 100, "height": 50 } ``` ``` -------------------------------- ### Get Current Context Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Retrieves the name of the current active context. ```APIDOC ## GET CURRENT CONTEXT ### Description Returns the current context. ### Method N/A (Keyword) ### Endpoint N/A (Keyword) ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **current_context** (string) - The name of the current context. #### Response Example N/A ``` -------------------------------- ### Open Application with Capabilities Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Opens a new application on the Appium server. This keyword accepts various capabilities for Android and iOS. Appium options can be set using a dictionary. ```robotframework Open Application http://localhost:4723 alias=Myapp1 platformName=iOS platformVersion=18.5 deviceName=iPhone 16 app=your.app ``` ```robotframework Open Application http://localhost:4723 alias=Myapp1 platformName=iOS platformVersion=18.5 deviceName=iPhone 16 app=your.app ignore_certificates=False ``` ```robotframework Open Application http://localhost:4723 platformName=Android platformVersion=4.2.2 deviceName=192.168.56.101:5555 app=${CURDIR}/demoapp/OrangeDemoApp.apk appPackage=com.netease.qa.orangedemo appActivity=MainActivity ``` ```robotframework Open Application http://localhost:4723 platformName=iOS appium:options=&{APPIUM_OPTIONS} ``` -------------------------------- ### Go To URL Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Opens the specified URL in the default web browser. ```APIDOC ## Go To URL ### Description Opens the `url` in the default web browser. ### Method Not specified (likely a keyword execution in Robot Framework) ### Endpoint Not applicable (keyword-based) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```robotframework Go To URL http://m.webapp.com ``` ### Response #### Success Response (200) None specified #### Response Example None specified ``` -------------------------------- ### Get Element Size API Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Returns the width and height of an element. ```APIDOC ## Get Element Size ### Description Returns the width and height of an element. ### Method Not specified (Keyword in Robot Framework) ### Endpoint Not applicable (Keyword in Robot Framework) ### Parameters - **locator** (string) - Required - The locator for the element. ### Request Example ```robotframework ${size}= Get Element Size id=image_view ``` ### Response - **size** (dict) - A dictionary containing 'width' and 'height'. ``` -------------------------------- ### Get Webelement Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Returns the first WebElement object that matches the provided locator. ```APIDOC ## GET /element ### Description Returns the first WebElement object matching locator. Example:
${element} Get Webelement id=my_element
Click Element ${element}
### Method GET ### Endpoint /element ### Parameters #### Query Parameters - **locator** (string) - Required - The locator for the element. ### Response #### Success Response (200) - **webelement** (object) - The WebElement object. #### Response Example ```json { "webelement": { "ELEMENT": "element-id-123" } } ``` ``` -------------------------------- ### Import AppiumLibrary with Optional Arguments Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html AppiumLibrary can be imported with optional arguments to configure default timeouts, failure handling, and sleep intervals. These settings can be modified later using specific keywords. ```robotframework Library AppiumLibrary 10 # Sets default timeout to 10 seconds ``` ```robotframework Library AppiumLibrary timeout=10 run_on_failure=No Operation # Sets default timeout to 10 seconds and does nothing on failure ``` ```robotframework Library AppiumLibrary timeout=10 sleep_between_wait_loop=0.3 # Sets default timeout to 10 seconds and sleep 300 ms between wait loop ``` -------------------------------- ### Get Appium Timeout Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Retrieves the current Appium timeout value in seconds. ```APIDOC ## GET APPIUM TIMEOUT ### Description Returns the timeout in seconds used by various keywords. ### Method N/A (Keyword) ### Endpoint N/A (Keyword) ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **timeout** (float) - The current timeout value in seconds. #### Response Example N/A ### Notes See Set Appium Timeout for an explanation. ``` -------------------------------- ### Library Import Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html AppiumLibrary can be imported with optional arguments to configure default timeouts and failure handling. ```APIDOC ## Library Import ### Description AppiumLibrary can be imported with optional arguments. - `timeout`: Default timeout for waiting actions. Can be set later with `Set Appium Timeout`. - `run_on_failure`: Specifies a keyword to execute when a AppiumLibrary keyword fails. Defaults to `Capture Page Screenshot`. Use `No Operation` to disable. - `sleep_between_wait_loop`: Default sleep duration between loops in wait until keywords. ### Examples ```robotframework Library AppiumLibrary 10 Library AppiumLibrary timeout=10 run_on_failure=No Operation Library AppiumLibrary timeout=10 sleep_between_wait_loop=0.3 ``` ``` -------------------------------- ### Get Appium Session ID Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Returns the current Appium session ID. ```APIDOC ## GET APPIUM SESSIONID ### Description Returns the current session ID as a reference. ### Method N/A (Keyword) ### Endpoint N/A (Keyword) ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **session_id** (string) - The current Appium session ID. #### Response Example N/A ``` -------------------------------- ### Get Android Activity Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Retrieves the current activity name for an Android device. ```APIDOC ## GET ACTIVITY ### Description Retrieves the current activity on the device. ### Method N/A (Keyword) ### Endpoint N/A (Keyword) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **activity** (string) - The name of the current activity. #### Response Example N/A ### Notes Android only. ``` -------------------------------- ### Library Import Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Imports the AppiumLibrary with configurable settings for timeout, failure handling, and wait loop intervals. ```APIDOC ## Library Import Imports the AppiumLibrary with configurable timeout, failure handling, and wait loop settings. ```robotframework *** Settings *** Library AppiumLibrary Library AppiumLibrary timeout=10 Library AppiumLibrary timeout=10 run_on_failure=No Operation Library AppiumLibrary timeout=10 sleep_between_wait_loop=0.3 ``` ``` -------------------------------- ### Handlebars AST Node Preparation Utilities Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Provides utility functions for preparing various Handlebars AST nodes, including paths, mustaches, blocks, and programs. These functions are crucial for transforming raw parsed data into a structured AST. ```javascript tD.default=tN,tj={};t(tj,"__esModule",()=>z,e=>z=e),t(tj,"SourceLocation",()=>X,e=>X=e),t(tj,"id",()=>Y,e=>Y=e),t(tj,"stripFlags",()=>Z,e=>Z=e),t(tj,"stripComment",()=>Q,e=>Q=e),t(tj,"preparePath",()=>ee,e=>ee=e),t(tj,"prepareMustache",()=>et,e=>et=e),t(tj,"prepareRawBlock",()=>er,e=>er=e),t(tj,"prepareBlock",()=>en,e=>en=e),t(tj,"prepareProgram",()=>eo,e=>eo=e),t(tj,"preparePartialBlock",()=>ei,e=>ei=e),z=!0,X=function(e,t){this.source=e,this.start={line:t.first_line,column:t.first_column},this.end={line:t.last_line,column:t.last_column}},Y=function(e){return/^\\\[.*\\\\]$/.test(e)?e.substring(1,e.length-1):e},Z=function(e,t){return{open:"~"===e.charAt(2),close:"~"===t.charAt(t.length-3)}},Q=function(e){return e.replace(/^\\{\\{~?!-?-?/,"").replace(/-?-?~?\\}\\}$/,"")} ``` ```javascript ee=function(e,t,r){r=this.locInfo(r);for(var n="@",o=[],i=0,a=0,s=t.length;a0)throw new t$.default("Invalid path: "+n,{loc:r});else".."===l&&i++}return{type:"PathExpression",data:e,depth:i,parts:o,original:n,loc:r}} ``` ```javascript et=function(e,t,r,n,o,i){var a=n.charAt(3)||n.charAt(2);return{type:/\\*\\[.*\\*\\]/.test(n)?"Decorator":"MustacheStatement",path:e,params:t,hash:r,escaped:"{"!==a&&"&"!==a,strip:o,loc:this.locInfo(i)}} ``` ```javascript er=function(e,t,r,n){tH(e,r);var o={type:"Program",body:t,strip:{},loc:n=this.locInfo(n)};return{type:"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:o,openStrip:{},inverseStrip:{},closeStrip:{},loc:n}} ``` ```javascript en=function(e,t,r,n,o,i){n&&n.path&&tH(e,n);var a=/\\*\\[.*\\*\\]/.test(e.open);t.blockParams=e.blockParams;var s=void 0,l=void 0;if(r){if(a)throw new t$.default("Unexpected inverse block on decorator",r);r.chain&&(r.program.body[0].closeStrip=n.strip),l=r.strip,s=r.program}return o&&(o=s,s=t,t=o),{type:a?"DecoratorBlock":"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:t,inverse:s,openStrip:e.strip,inverseStrip:l,closeStrip:n&&n.strip,loc:this.locInfo(i)}} ``` ```javascript eo=function(e,t){if(!t&&e.length){var r=e[0].loc,n=e[e.length-1].loc;r&&n&&(t={source:r.source,start:{line:r.start.line,column:r.start.column},end:{line:n.end.line,column:n.end.column}})}return{type:"Program",body:e,strip:{},loc:t}} ``` ```javascript ei=function(e,t,r,n){return tH(e,r),{type:"PartialBlockStatement",name:e.path,params:e.params,hash:e.hash,program:t,openStrip:e.strip,closeStrip:r&&r.strip,loc:this.locInfo(n)}} ``` -------------------------------- ### Get Appium Capability Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Fetches the value of a specific desired capability by its name. ```robotframework Get Capability capability_name=platformName ``` -------------------------------- ### Get Element Location API Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Returns the x and y coordinates of the center of an element. ```APIDOC ## Get Element Location ### Description Returns the x,y coordinates of an element. ### Method Not specified (Keyword in Robot Framework) ### Endpoint Not applicable (Keyword in Robot Framework) ### Parameters - **locator** (string) - Required - The locator for the element. ### Request Example ```robotframework ${location}= Get Element Location id=floating_button ``` ### Response - **location** (dict) - A dictionary containing 'x' and 'y' coordinates. ``` -------------------------------- ### Get Element Attribute API Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Retrieves the value of a specific attribute from an element. ```APIDOC ## Get Element Attribute ### Description Returns the value of a specific attribute from an element. ### Method Not specified (Keyword in Robot Framework) ### Endpoint Not applicable (Keyword in Robot Framework) ### Parameters - **locator** (string) - Required - The locator for the element. - **attribute** (string) - Required - The name of the attribute to retrieve. ### Request Example ```robotframework ${name}= Get Element Attribute id=my_button name ``` ### Response - **attribute_value** (string) - The value of the requested attribute. ``` -------------------------------- ### Flick Gesture Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Performs a flick gesture from a starting point to an ending point on the screen. ```APIDOC ## FLICK ### Description Flicks from one point to another point. ### Method N/A (Keyword) ### Endpoint N/A (Keyword) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```robotframework Flick 100 100 100 400 # Flicks the screen up. ``` ### Response #### Success Response (200) N/A #### Response Example N/A ### Keyword Arguments - **start_x** (int) - Required - x-coordinate at which to start - **start_y** (int) - Required - y-coordinate at which to start - **end_x** (int) - Required - x-coordinate at which to stop - **end_y** (int) - Required - y-coordinate at which to stop ``` -------------------------------- ### Open Application Source: https://context7.com/serhatbolsu/robotframework-appiumlibrary/llms.txt Opens a new application session with the Appium server using specified capabilities for Android and iOS. ```APIDOC ## Open Application Opens a new application session with the Appium server using specified capabilities. ```robotframework *** Variables *** ${REMOTE_URL} http://localhost:4723 ${ANDROID_AUTOMATION} UIAutomator2 ${ANDROID_APP} ${CURDIR}/demoapp/ApiDemos-debug.apk ${ANDROID_PLATFORM} Android ${ANDROID_VERSION} 11 &{APPIUM_OPTIONS} deviceName=iPhone 15 Pro platformVersion=17.0 app=your.app automationName=XCUITest *** Test Cases *** Open Android Application Open Application ${REMOTE_URL} ... alias=MyAndroidApp ... platformName=${ANDROID_PLATFORM} ... platformVersion=${ANDROID_VERSION} ... deviceName=emulator-5554 ... app=${ANDROID_APP} ... appPackage=io.appium.android.apis ... appActivity=.ApiDemos ... automationName=${ANDROID_AUTOMATION} Open iOS Application Open Application ${REMOTE_URL} ... alias=MyiOSApp ... platformName=iOS ... platformVersion=18.5 ... deviceName=iPhone 16 ... app=/path/to/your.app ... automationName=XCUITest Open Application With Options Dictionary Open Application ${REMOTE_URL} platformName=iOS appium:options=&{APPIUM_OPTIONS} Open Application With SSL Options Open Application ${REMOTE_URL} alias=SecureApp platformName=Android ignore_certificates=False ``` ``` -------------------------------- ### Get Device Location Source: https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/master/docs/AppiumLibrary.html Retrieves the current GPS location and address information of the device. ```APIDOC ## GET DEVICE LOCATION ### Description Gets the device's current GPS location with human-readable address information. ### Method N/A (Keyword) ### Endpoint N/A (Keyword) ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **location_data** (object) - An object containing GPS coordinates and address components. #### Response Example N/A ### Notes Retrieves GPS coordinates from the connected device and performs reverse geocoding to convert coordinates into readable address components. ```