robotframework-appiumlibrary icon indicating copy to clipboard operation
robotframework-appiumlibrary copied to clipboard

Robot Frame work with Appium throws KeyError:'Platform Name' i

Open prgovind opened this issue 8 years ago • 6 comments

I am learning how to use Appium with Robot Framework. My Test case is to login and logout a Gmail webpage in Chrome using a Samsung mobile, with Android version 4.4.2.

web page is launched successfully - but while entering the username, I am faced with an issue of:

Keyerror: 'Platform Name'. Keyerror Issue.txt

SW version:

Appium Version - 1.4.16 Robot Frame work Version - 3.0

Below is my Robot code I am using:

*** settings *** Library AppiumLibrary Resource D:\Resource.txt Keyerror Issue.txt

*** Test Cases *** Login into Gmail Account Open Browser to Login Gmail Login Details

*** Keywords *** Open Browser to Login Gmail

 Open Application    http://127.0.0.1:4723/wd/hub  platformName=Android  platformVersion=4.4.2  deviceName=42034dbac8074100  app=com.android.browser  automationName=appium  appPackage=com.android.browser  appActivity=com.google.android.apps.chrome.Main
 Go To Url    https://www.gmail.com
 Sleep    5
 #Wait Until Page Contains    ${loginID}

Login Details
Input Text ${loginID} ${UserNameValue}
Click Element ${Next}
Input Password ${Password} ${PwdValue} Which results in the error:

KeyError: 'platformName'

prgovind avatar Feb 01 '17 12:02 prgovind

Did you try newer versions of Appium ? Such as 1.6.3.

If you are using the Desktop app for appium, just install Appium as external. screen shot 2017-02-03 at 14 58 07

serhatbolsu avatar Feb 03 '17 11:02 serhatbolsu

@prgovind Try changing your Open Application string to:

Open Application http://127.0.0.1:4723/wd/hub platformName=Android platformVersion=4.4.2 deviceName=42034dbac8074100 browserName=Chrome

tylerpitchford avatar Mar 03 '17 18:03 tylerpitchford

I have exactly the same issue on Windows 10(Installed latest version of Appium). In my case, it was caused by robotframework-appiumlibrary-1.4.3 Downgrading to version 1.3.2 fixed the issue, but unfortunately there are some useful keywords missing (like count xpath matches) Can anyone suggest how I can use the latest version? That's the log when I am trying to click on element using version 1.4.3:

17:15:14.286 FAIL KeyError: 'platformName'

17:15:14.286 DEBUG Traceback (most recent call last): File "", line 2, in click_element File "C:\Python27\lib\site-packages\AppiumLibrary\keywords\keywordgroup.py", line 15, in _run_on_failure_decorator return method(*args, **kwargs) File "C:\Python27\lib\site-packages\AppiumLibrary\keywords_element.py", line 42, in click_element self._element_find(locator, True, True).click() File "C:\Python27\lib\site-packages\AppiumLibrary\keywords_element.py", line 559, in _element_find if self._get_platform() == 'ios': File "C:\Python27\lib\site-packages\AppiumLibrary\keywords_applicationmanagement.py", line 216, in _get_platform raise e

arthurmx avatar Mar 06 '17 17:03 arthurmx

@arthurmx which version appium are you using

serhatbolsu avatar Mar 08 '17 11:03 serhatbolsu

@serhatbolsu 1.4.16 Upgrading to the v, 1.6.3 fixed this Issue

arthurmx avatar Mar 08 '17 13:03 arthurmx

@prgovind and @arthurmx I'm able to automate above test case. Appium Version - 1.4.16 robotframwork - 3.0 robotframwork-appiumlibrary - 1.3.5

Below is my code:

*** Settings ***
Library  AppiumLibrary

*** Test Cases ***
TC_Gmail_Login
    [Documentation]    Login into Gmail Account
    Open Browser to Login Gmail
    AppiumLibrary.Input Text    xpath=//input [@id='Email']    [email protected]
    AppiumLibrary.Click Element    xpath=//input [@id='next']
    AppiumLibrary.Wait Until Page Contains Element  xpath=//input [@id='Passwd']  20
    AppiumLibrary.Input Text    xpath=//input [@id='Passwd']    abcde
    AppiumLibrary.Click Element    xpath=//input [@id='signIn']
    AppiumLibrary.Wait Until Page Contains Element  xpath=//div[@aria-label='Compose' and @role='button']  20

[Teardown]  AppiumLibrary.Close Application

*** Keywords ***
Open Browser to Login Gmail
    [Documentation]  asdasd
    Open Application    http://127.0.0.1:4723/wd/hub  platformName=Android  platformVersion=5.0.1  deviceName=yourdevicename  app=com.android.browser  automationName=appium  appPackage=com.android.browser  appActivity=com.google.android.apps.chrome.Main
    Go To Url    https://www.gmail.com
    Wait Until Page Contains  Enter your email  20

@prgovind from your log file I could only found out that appium is timing out due to command not received within 60 sec, can you try with bigger command-timeout e.g. I start appium on command line with below command appium --command-timeout 0

UlhasDeshmukh avatar Mar 09 '17 04:03 UlhasDeshmukh

Closing due to inactivity

serhatbolsu avatar Oct 27 '22 08:10 serhatbolsu