Appium + AppiumLibrary in real devices

1,785 views
Skip to first unread message

Ana Padinha

unread,
Oct 12, 2015, 11:10:12 AM10/12/15
to robotframework-users
Hi Guys,

I really need some help here..

I want to run a robot framework test with appium library and appium server.
I am able to install the application with the test but then the keywords don't work.
The test PASS, but the actions I wanted to happen didn´t happen actually.


RESOURCE:
*** Settings ***
Library         AppiumLibrary  run_on_failure=Log Source


*** Variables ***
${REMOTE_URL}  http://localhost:4723/wd/hub
${APP}            something something..... sorry I cant share this download link
*** Keywords ***
TestStart
    [Documentation]  just demo
    Open Application  ${REMOTE_URL}  platformName=platformVersion=5.0.2  deviceName=90be27f5  app=${APP} automationName=appium 
    Capture Page Screenshot

TEST:

*** Settings ***
Documentation   demo for appium library
Force Tags      demo
Resource        demo_resoure.txt


*** Test Cases ***
test_demo
    [Tags]  regression
    Open Application  http://localhost:4723/wd/hub  platformName=Android  platformVersion=5.0.1  deviceName=90be27f5  app=${APP}  automationName=appium
    Click Button    Yes
    Wait Until Page Contains    some...@else.com    timeout=30s
    Click Element    xpath=//android.widget.TextView[@text='bla...@gmail.com']
    Wait Until Page Contains Element   xpath=//android.widget.Button[@index='111']    timeout=30s
    Click Element    xpath=//android.widget.Button[@index='111']
  
    Click Element    xpath=//android.webkit.WebView[@content-desc='Welcome!']
    Click Element    xpath=//android.view.View[@index='102']
    Page Should Contain Text   3045
   
    Close Application

I don't know if it helps to debug this but If I open the UI Automator Viewer to check the real device screen and get the UI XML screenshot, I have to find the elements searching by the name or one by one because if I click in the preview it shows information about other element in another layer or something. Im testing in android 5.0.1

Please any information is valid or even some place online where I can ask this better or read about this is good.





tmpalaniselvam

unread,
Nov 2, 2015, 8:27:03 AM11/2/15
to robotframework-users
I'm also facing this issue. I was able to execute my C# + appium tests on Windows 10 machine. Installed robotframework-appium library and tried simple test. First of all, unable to import Appium Library. Getting following error
[ ERROR ] Error in file 'D:\Study\RobotFramework\samples\AppiumCalc\resource1.html': Importing test library 'AppiumLibrary' failed: ImportError: No module named AppiumLibrary
Traceback (most recent call last):

Any suggestions/solutions?

Karolina

unread,
Jan 27, 2016, 10:12:32 AM1/27/16
to robotframework-users
Hi Ann, 

I'm using appium+rf on real devices (android) and I always see wha tis happening on my device when test are running.

I have this structure on the beggining:

Close All Applications
 Register Keyword To Run On Failure    Log Variables
Open Application    http://localhost:4723/wd/hub    platformName=${platform_name}    platformVersion=${api_level}    deviceName=${device_name}    app=${CURDIR}\\debug.apk
Set Network Connection Status    2

And when I run tests:
1. make sure that device is connected via USB port, 
2. first start the server appium
3. then run tests from RF

Regards,
Karolina

Timo Lotila

unread,
Mar 24, 2016, 5:29:08 AM3/24/16
to robotframework-users
Using the index # is not a good way to recognize the object. Please try to use another attribute with more unique identifier. If the resource id cannot be used cause it is empty one option is to add the accessibilitylabel to every view with unique naming convention and use that to recognize the button or any object you do need to use. If the button have attribute i.e. text="OK" that can be used also.

The bottom line is that the application must have unique identifier, w/o that the automation is next to impossible.

Timo

Timo Lotila

unread,
Mar 24, 2016, 5:29:08 AM3/24/16
to robotframework-users
Please use pip to install the appium library: pip install robotframework-appiumlibrary
At least for me that did do the trick.
Reply all
Reply to author
Forward
0 new messages