skip to Main Content

when i write a simple test case i get an error like below

==============================================================================
Example                                                                       
==============================================================================
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No application is open
Example Case                                                          | FAIL |
WebDriverException: Message: platform name is missing in the capabilities
------------------------------------------------------------------------------
Example                                                               | FAIL |
1 test, 0 passed, 1 failed
==============================================================================

My robot file

*** Settings ***
Library    AppiumLibrary

*** Variables ***
${REMOTE_URL}  secretHubLink
${APP}    secretAppUrl
${PLATFORM_NAME}    Android
${PLATFORM_VERSION}    10
${DEVICE_NAME}    Galaxy S20

*** Test Cases ***
Example Case
    Open Application  ${REMOTE_URL}  platformName=${PLATFORM_NAME}  platformVersion=${PLATFORM_VERSION}  deviceName=${DEVICE_NAME}    app=${APP}   name=Robot Framework Sample Test    build=Appium Python Robot

My requirements.txt
robotframework-appiumlibrary

My Packages: (pip freeze)

Appium-Python-Client==2.7.1
async-generator==1.10
attrs==22.2.0
certifi==2022.12.7
decorator==5.1.1
docutils==0.19
exceptiongroup==1.1.0
h11==0.14.0
idna==3.4
kitchen==1.2.6
outcome==1.2.0
PySocks==1.7.1
robotframework==6.0.1
robotframework-appiumlibrary==2.0.0
selenium==4.7.2
six==1.16.0
sniffio==1.3.0
sortedcontainers==2.4.0
trio==0.22.0
trio-websocket==0.9.2
urllib3==1.26.13
wsproto==1.2.0
selenium==4.7.2
  • Os: Linux / Ubuntu 20.04.4 LTS
  • Python version: 3.8.10

2

Answers


  1. ${REMOTE_URL}               http://127.0.0.1:4723/wd/hub
    ${MAIN_ACTIVITY}            com.dev
    
    *** Keywords ***
    Start Up Application
        [Documentation]    Starts up application session
        [Arguments]    ${platformName}    ${platformVersion}=    ${deviceName}=    ${portNumber}=4723
        ${appName}=              Get App Name
        ${bundleName}=     Run Keyword If    '${platformName.lower()}' == 'ios'     Get iOS Bundle Name
        ...                ELSE                                                     Get Android Bundle Name
        Run Keyword If    '${platformName.lower()}' == 'ios'    Open Application     ${REMOTE_URL}    waitForQuiescence=false    wdaEventloopIdleDelay=3     platformName=${platformName}    platformVersion=${platformVersion}    deviceName=${deviceName}    app=${appName}    bundleId=${bundleName}      autoAcceptAlerts=true    connectHardwareKeyboard=true
        ...    ELSE    Open Application    ${REMOTE_URL}    platformName=${platformName}   platformVersion=${platformVersion}    deviceName=${deviceName}    appPackage=${bundleName}    appActivity=${MAIN_ACTIVITY}     autoGrantPermissions=true     noReset=true
    
    Login or Signup to reply.
  2. *** Settings ***
    Documentation     Smoke Demo
    ...
    #Test Setup    AppiumLibrary.Launch Application
    Test Teardown    Close Application
    Library    AppiumLibrary
    Library    OperatingSystem
    
    *** Variables ***
    ${ANDROID_AUTOMATION_NAME}    UIAutomator2
    ${ANDROID_APP}                AbsPath to Your .apk
    ${ANDROID_PLATFORM_NAME}      Android
    ${ANDROID_PLATFORM_VERSION}   %{ANDROID_PLATFORM_VERSION=13}
    
    *** Test Cases ***
    Should Open App
      Open Test Application
    
    *** 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
    

    Please check this one a simpler option, works for me

    here sample .apk that I use for this test

    Guide with simple example here

    source code

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search