When we get to the topic of Native & Hybrid
automation, Appium is one of a great solution I have ever found. It’s an open source
test automation framework that drives
iOS, Android, and Windows applications.
Appium support any automation framework and can be use with any programming language. So, if you are good with Selenium Robot framework, get ready to develop your first automation script after reading this blog.
Note - This article is focus on android automation.
Installation...
- Install Selenium Robot Framework - http://qasrilanka.blogspot.com/2013/12/selenium-in-3-days-day-2-getting.html
- Install latest Java JDK - http://www.oracle.com/technetwork/java/javase/downloads/index.html
- Install latest android SDK - https://developer.android.com/studio/index.html
- set ANDROID_HOME
- add 'tools' and 'platform-tools' folders to PATH variable
- Install Appium - Download the latest RF supported Appium build here- AppiumForWindows_1_4_16_1.zip from https://bitbucket.org/appium/appium.app/downloads/
- Install the latest Appium library (robotframework-appiumlibrary 1.4.4) from https://pypi.python.org/pypi/robotframework-appiumlibrary/
- > pip uninstall robotframework-appiumlibrary (To uninstall previous version of appium library (if any))
- > cd C:\Python27\Scripts\robotframework-appiumlibrary-1.4.4 (Go to the directory which include appium library)
- > python setup.py install
- Execute 'Appium.exe' to launch Appium
- Set Application path & other parameters.
- Click 'Run' button in the top right hand corner to start Appium server & Launch the application using attached device or emulator.
Connect AVD (Android Virtual Device) or Real device...
- If you are connect a real device, use 'adb devices' command to get the deviceName. (adb is located inside the 'platform-tools' folder) deviceName is one of the Appium server capability which is used with 'Open Application' keyword in your robot script. you will learn these keywords and capabilities later.
- If use don't have a actual device, then you should boot a AVD (Emulator) with API Level 17 or greater. see above image. you can see 'Launch AVD' parameter.
How to create an AVD ?
- Open 'AVD Manager.exe' which is located inside the SDK folder (..\AppData\Local\Android\sdk)
- Create a new AVD
Locating elements in Android apps...
- 'uiautomatorviewer' is a great tool comes with SDK that helps to get element's XPath, ID, Name And className. it is located inside the tools folder. (..\AppData\Local\Android\sdk\tools)
Take the above image. Few examples of how to locate the serverIP text field are given below.
Write your first code...- Locating element by resource-id : id=com.qmatic.concierge:id/et_ip
- Locating element by class and resource-id : xpath=//android.widget.EditText[contains(@resource-id,'com.qmatic.concierge:id/et_ip')]
- Locating element by class and index : xpath=//android.widget.EditText[@index='1']
*** Settings ***
Documentation This resource file contains global variables and keywords
... [Author] Nishantha Thilakawardana
Library AppiumLibrary 20
*** Variables ***
${REMOTE_URL} http://localhost:4723/wd/hub
${PLATFORM_NAME} Android
${PLATFORM_VERSION} 6.0.1
${DEVICE_NAME} Galaxy Tab S2
${APP} F:\\Projects\\Orchestra_Mobile_Connect_Concierge-1.1.1.7.apk
${TIME OUT} 20 sec
${Retry_Int} 3 sec
*** Test Cases ***
Concierge_Login
[Documentation] Android Automation for MobileConnectConcierge
[Tags] demo
submit system settings
*** Keywords ***
submit system settings
Open Application ${REMOTE_URL} platformName=Android platformVersion=${PLATFORM_VERSION} deviceName=${DEVICE_NAME} app=${APP} automationName=appium appPackage=com.qmatic.concierge
Clear Text id=com.qmatic.concierge:id/et_ip
Input Text id=com.qmatic.concierge:id/et_ip X.X.X.X
Clear Text id=com.qmatic.concierge:id/et_port
Input Text id=com.qmatic.concierge:id/et_port XXXX
Click Element id=com.qmatic.concierge:id/btnConnect
I assume, you have a fair knowledge of selenium robot framework and keyword driven development to understand the above script.
You can find the complete keyword documentation here.
Also you can find the complete list of key codes which can be use with keyword "Press Keycode" here.
So, I hope this article help beginners who like to acquire some basics of Android automation. Lets meet soon with another technical stuff. have a great day!
you have written an excellent blog.. keep sharing your knowledge...
ReplyDeleteRobot Framework Test Automation Course in Chennai
Robot Framework Test Automation Online Course
Great Content. It will useful for knowledge seekers. Keep sharing your knowledge through this kind of article.
ReplyDeleteIELTS Writing Skills
IELTS Writing Tasks
During a OctaFx Review workshop, each attendee will learn how to interpret market action using proven charting techniques, searching for reliable chart patterns and indicators to help them identify trading opportunities.
ReplyDeleteThis post is so useful and informative. Keep updating with more information.....
ReplyDeleteIELTS Certification
IELTS Coaching
yozgat
ReplyDeletesivas
bayburt
van
uşak
DJ8
goruntulu show
ReplyDeleteücretli
8E3DZ
ankara parça eşya taşıma
ReplyDeletetakipçi satın al
antalya rent a car
antalya rent a car
ankara parça eşya taşıma
V3CUQ
B302A
ReplyDeleteÜnye Marangoz
Karabük Lojistik
Uşak Parça Eşya Taşıma
Balıkesir Parça Eşya Taşıma
Kilis Şehir İçi Nakliyat
AAX Güvenilir mi
Etimesgut Fayans Ustası
Amasya Parça Eşya Taşıma
Nevşehir Lojistik
D5723
ReplyDeleteindirim kodu %20
C5C29
ReplyDeletekomisyon indirimi %20
DFGBFGFHBFGYTNHJ
ReplyDeleteشركة مكافحة حشرات
تنظيف خزانات بخميس مشيط 93DYauW2XO
ReplyDeleteشركة مكافحة النمل الابيض بخميس مشيط O22NVifBJm
ReplyDeleteشركة مكافحة حشرات بالهفوف qpKSxXRFrs
ReplyDeleteشركة صيانة افران بالاحساء XFjIdGDkck
ReplyDeleteشركة عزل اسطح بالقطيف dtHN9WxqwQ
ReplyDeleteشركة تنظيف فلل بالاحساء pInvLje7PP
ReplyDelete