Executing Your Local Mobile Automation Robot Code
Executing Your Local Mobile Automation Robot Code
Robot Framework is a generic open-source automation framework. Robot Framework can be integrated with virtually any other tool to create powerful and flexible automation solutions such as Appium and Selenium. Robot Framework is free to use without licensing costs.
Robot Framework has an easy syntax, utilizing human-readable keywords. Its capabilities can be extended by libraries implemented with Python, Java or many other programming languages. Robot Framework has a rich ecosystem around it, consisting of libraries and tools that are developed as separate projects.
Prerequisites
- TestGrid login credentials and Device cloud link
- Robot Framework Set Up. (Using python pip/pip3)
- You need to add your desired remote Device URL and UDID from the TestGrid device cloud and paste it inside the ${url} and ${udid} variable in your robot code. Rest of the appium capabilities in your robot code will remain same.
Additionally, Remote Execution of Code can also be viewed live on TestGrid Device Cloud.
You can find Detailed steps on https://serhatbolsu.github.io/robotframework-appiumlibrary/AppiumLibrary
** Settings ** Library AppiumLibrary ** Variables ** ${url} http://demo.testgrid.io:64110/wd/hub ${udid} TG001DEVICEUDID ** Test Cases ** TC01 Open Application ${url} udid=${udid} platformName=Android appPackage=com.eajy.materialdesigndemo appActivity=com.eajy.materialdesigndemo.activity.MainActivity noReset=${True} FOR ${index} IN RANGE 3 Wait Until Page Contains Element id=com.eajy.materialdesigndemo:id/btn_card_main1_action1 Click Element id=com.eajy.materialdesigndemo:id/btn_card_main1_action1 Click Element id=com.eajy.materialdesigndemo:id/btn_card_main1_action2 Set Appium Timeout 2 Swipe 400 1600 400 800 Set Appium Timeout 5 Click Element id=com.eajy.materialdesigndemo:id/img_main_card2_favorite Set Appium Timeout 5 Click Element id=com.eajy.materialdesigndemo:id/img_main_card2_bookmark Swipe 400 800 400 1600 Set Appium Timeout 5 seconds Click Element xpath=//android.support.v7.app.a.c[@content-desc="Dialogs"]/android.widget.TextView Wait Until Page Contains Element id=com.eajy.materialdesigndemo:id/btn_dialog_1 Click Element id=com.eajy.materialdesigndemo:id/btn_dialog_3 Wait Until Page Contains Element xpath=/android.widget.FrameLayout/android.widget.ListView/android.widget.CheckedTextView[3] Click Element xpath=/hierarchy/android.widget.FrameLayout/android.widget.ListView/android.widget.CheckedTextView[3] Click Element id=com.eajy.materialdesigndemo:id/btn_dialog_9 Wait Until Element Is Visible id=com.eajy.materialdesigndemo:id/btn_dialog_bottom_sheet_ok Click Element id=com.eajy.materialdesigndemo:id/btn_dialog_bottom_sheet_ok Click Element xpath=//android.support.v7.app.a.c[@content-desc="Widgets"]/android.widget.TextView Set Appium Timeout 10 Click Element id= com.eajy.materialdesigndemo:id/switch1 Swipe 400 1800 400 200 Click Element id= com.eajy.materialdesigndemo:id/checkBox2 Click Element id=com.eajy.materialdesigndemo:id/checkBox3 Set Appium Timeout 20 Click Element id=com.eajy.materialdesigndemo:id/radioButton2 Click Element id=com.eajy.materialdesigndemo:id/radioButton3 Swipe 400 200 400 1800 Set Appium Timeout 20 Click Element xpath=//android.support.v7.app.a.c[@content-desc="Cards"]/android.widget.TextView # repeat the same process to create a loop Wait Until Page Contains Element id = com.eajy.materialdesigndemo:id/btn_card_main1_action1 Click Element id=com.eajy.materialdesigndemo:id/btn_card_main1_action1 Click Element id=com.eajy.materialdesigndemo:id/btn_card_main1_action2 Set Appium Timeout 2 Swipe 400 1600 400 800 Set Appium Timeout 5 Click Element id=com.eajy.materialdesigndemo:id/img_main_card2_favorite Set Appium Timeout 5 Click Element id=com.eajy.materialdesigndemo:id/img_main_card2_bookmark Swipe 400 800 400 1600 Set Appium Timeout 5 seconds Click Element xpath=//android.support.v7.app.a.c[@content-desc="Dialogs"]/android.widget.TextView Wait Until Page Contains Element id=com.eajy.materialdesigndemo:id/btn_dialog_1 Click Element id=com.eajy.materialdesigndemo:id/btn_dialog_3 Wait Until Page Contains Element xpath=/hierarchy/android.widget.FrameLayout/android.widget.CheckedTextView[3] Click Element xpath=/hierarchy/android.widget.FrameLayout/android.widget.ListView/android.widget.CheckedTextView[3] Click Element id=com.eajy.materialdesigndemo:id/btn_dialog_9 Wait Until Element Is Visible id=com.eajy.materialdesigndemo:id/btn_dialog_bottom_sheet_ok Click Element id=com.eajy.materialdesigndemo:id/btn_dialog_bottom_sheet_ok Click Element xpath=//android.support.v7.app.a.c[@content-desc="Widgets"]/android.widget.TextView Set Appium Timeout 10 Click Element id= com.eajy.materialdesigndemo:id/switch1 Swipe 400 1800 400 200 Click Element id= com.eajy.materialdesigndemo:id/checkBox2 Click Element id=com.eajy.materialdesigndemo:id/checkBox3 Insert Into Element id=com.eajy.materialdesigndemo:id/checkBox3 value='Test' Set Appium Timeout 20 Click Element id=com.eajy.materialdesigndemo:id/radioButton2 Click Element id=com.eajy.materialdesigndemo:id/radioButton3 Swipe 400 200 400 1800 Set Appium Timeout 20 Click Element xpath=//android.support.v7.app.a.c[@content-desc="Cards"]/android.widget.TextView END
As simple as that! Happy Testing 🙂