Giter VIP home page Giter VIP logo

robotframework-appiumlibrary's Introduction

Appium library for RobotFramework

AppiumLibrary is an appium testing library for Robot Framework. Library can be downloaded from PyPI.

It uses Appium to communicate with Android and iOS application similar to how Selenium WebDriver talks to web browser.

It is supporting Python 3.7+ (since Appium Python Client doesn't support Python 2.7 anymore)

Latest PyPI version Number of PyPI downloads License

See Keyword Documentation for available keywords and more information about the library in general.

Option 1 (recommended)

The recommended installation method is using pip:

pip install --upgrade robotframework-appiumlibrary

Option 2

It is possible to install directly from GitHub repository. To Install latest source from the master branch, use this command: pip:

pip install git+https://github.com/serhatbolsu/robotframework-appiumlibrary.git

Please note that installation will take some time, because pip will clone the AppiumLibrary project to a temporary directory and then perform the installation.

See Robot Framework installation instructions for detailed information about installing Python and Robot Framework itself.

After installing the library, you still need to setup an simulator/emulator or real device to use in tests. iOS and Android have separate paths to follow, and those steps better explained in Appium Driver Setup Guide. Please follow the Driver-Specific Setup according to platform.

To write tests with Robot Framework and AppiumLibrary, AppiumLibrary must be imported into your RF test suite. See Robot Framework User Guide for more information.

As it uses Appium make sure your Appium server is up and running. For how to use Appium please refer to Appium Documentation

When using Robot Framework, it is generally recommended to write tests easy to read/modify. The keywords provided in AppiumLibrary are pretty low level. It is thus typically a good idea to write tests using Robot Framework's higher level keywords that utilize AppiumLibrary keywords internally. This is illustrated by the following example where AppiumLibrary keywords like Input Text are primarily used by higher level keywords like Input Search Query.

*** Settings ***
Documentation  Simple example using AppiumLibrary
Library  AppiumLibrary

*** Variables ***
${ANDROID_AUTOMATION_NAME}    UIAutomator2
${ANDROID_APP}                ${CURDIR}/demoapp/ApiDemos-debug.apk
${ANDROID_PLATFORM_NAME}      Android
${ANDROID_PLATFORM_VERSION}   %{ANDROID_PLATFORM_VERSION=11}

*** Test Cases ***
Should send keys to search box and then check the value
  Open Test Application
  Input Search Query  Hello World!
  Submit Search
  Search Query Should Be Matching  Hello World!


*** 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

Input Search Query
  [Arguments]  ${query}
  Input Text  txt_query_prefill  ${query}

Submit Search
  Click Element  btn_start_search

Search Query Should Be Matching
  [Arguments]  ${text}
  Wait Until Page Contains Element  android:id/search_src_text
  Element Text Should Be  android:id/search_src_text  ${text}

Create a file with the content above (name it: test_file.robot) and execute:

robot test_file.robot

The above example is single file test case, more examples can be found in a sample project that illustrates using Robot Framework and AppiumLibrary. Check the sample project that you can find examples of mobile web & ios & android.

Fork the project, make a change, and send a pull request!

William Zhang
William Zhang

πŸ’»
Serhat Bolsu
Serhat Bolsu

πŸ’»
Jari Nurminen
Jari Nurminen

πŸ’»
Xie Lieping
Xie Lieping

πŸ’»
Joshua Rivera
Joshua Rivera

πŸ’»
js361014
js361014

πŸ’»
matthew-dahm
matthew-dahm

πŸ’»
akupahkala
akupahkala

πŸ’»
soukingang
soukingang

πŸ’»
erik1510
Erik Bartalos

πŸ’»
minhnguyenphuonghoang
Minh Nguyen

πŸ’»
sadikkuzu
Sadik Kuzu

πŸ’»
kshrestha99
KumarS

πŸ’»
lucyking
Xia Clark

πŸ’»
arnaudruffin
Arnaud Ruffin

πŸ’»
jvilla17
Junuen Villa

πŸ’»
idxn
Tanakiat Srisaranyakul

πŸ’»
tbrito-daitan
Thiago Paiva Brito

πŸ’»
Meallia
Jonathan Gayvallet

πŸ’»
jennyw1
jennyw1

πŸ’»
ac-simoes
ac-simoes

πŸ’»
JMcn
JMcn

πŸ’»
UlhasDeshmukh
Ulhas Deshmukh

πŸ’»
smaspe
smaspe

πŸ’»
leongxf
Leon Guo

πŸ’»
extr3mal
eXtReMaL

πŸ’»
babarpramod
Pramod

πŸ’»
erolstt
Erol Selitektay

πŸ’»
filipehb
Filipe Henrique Benjamim de Arruda

πŸ’»
filipehba
Filipe Arruda

πŸ’»
felipetortella
Felipe Luiz Tortella

πŸ’»

AppiumLibrary is modeled after (and forked from) appiumandroidlibrary, but re-implemented to use appium 1.X technologies.

robotframework-appiumlibrary's People

Contributors

akupahkala avatar arnaudruffin avatar babarpramod avatar emanlove avatar erik1510 avatar extr3mal avatar frankbp avatar idxn avatar jennyw1 avatar jmcn avatar jollychang avatar joshuariveramnltech avatar js361014 avatar jvilla17 avatar kshrestha99 avatar lannyzhujin avatar leongxf avatar lucyking avatar matthew-dahm avatar meallia avatar minhnguyenphuonghoang avatar s4more avatar sadikkuzu avatar serhatbolsu avatar smaspe avatar soukingang avatar tbrito-daitan avatar ulhasdeshmukh avatar yahman72 avatar zastress avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robotframework-appiumlibrary's Issues

keyword for Appium precise tap?

I don't see a keyword for a precise tab. I have an embedded URL on a UIAWindow that has no element to use the existing "Tap" keyword. I need to tap with precise coordinates.
Here it is in the Inspector:

appium_inspector

getting AppiumLibrary' failed: ImportError: No module named sauceclient after new install

simple sudo pip install robotframework-appiumlibrary installation. When I try to run my test(s) I get this:

[ ERROR ] Error in file '/Users/si-briancohen/jenkins_home/workspace/Sys_Integrity_Automation/consumer_mobile/resources/resources_mobile.robot': Importing test library 'AppiumLibrary' failed: ImportError: No module named sauceclient
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/AppiumLibrary/__init__.py", line 4, in <module>
    from keywords import *
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/AppiumLibrary/keywords/__init__.py", line 5, in <module>
    from _element import _ElementKeywords
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/AppiumLibrary/keywords/_element.py", line 3, in <module>
    from appium.webdriver.common.touch_action import TouchAction
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/appium/__init__.py", line 18, in <module>
    from .saucetestcase import SauceTestCase
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/appium/saucetestcase.py", line 20, in <module>
    from sauceclient import SauceClient
PYTHONPATH:
  /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/robot/libraries
  /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
  /usr/local/bin
  /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.9.7-py2.7.egg
  /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.4-py2.7.egg
  /usr/local/lib/python2.7/site-packages/setuptools-0.9.7-py2.7.egg
  /usr/local/lib/python2.7/site-packages/pip-1.4-py2.7.egg
  /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
  /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7
  /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
  /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
  /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
  /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
  /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
  /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
  /Library/Python/2.7/site-packages
  /usr/local/lib/python2.7/site-packages

Demo Add_Contact problem

Hi,
I found that the demo apk packaged, doesn't have any form to add contacts, so the test_android_contacts.txt demo test fails.

Thanks for this awesome lib!

Pedro

Appium Python Client Switch To

Hello,
I find your library very useful.

I found that it is base on Appium Python Client, and just found out that Appium Python Client has some function to switch between native and webview context.

Would it be possible in a future release to have a "Switch To Context" and a "Get context" keywords, in the library ?

Thank you very much,
and congratulations for your hard work.

Error: pybot OrangeDemoApp.html

I have installed robotframework-appiumlibrary through pip command, but when I entered demo and executed pybot OrangeDemoApp.html, it has the following errors:

Importing test library 'AppiumAndroidLibrary' failed: ImportError: No module named AppiumAndroidLibrary

How can I fix it?

Importing test library '/path/AppiumLibrary' failed: ValueError: Expecting , delimiter: line 171 column 5 (char 4660)

I got stuck when running testing here:

[ ERROR ] Error in file '/Users/vunguyen/automation/customclient/libs/keywordsLib/customAppKeywords.txt': Importing test library '/Users/vunguyen/automation/customclient/tools/AppiumLibrary' failed: ValueError: Expecting , delimiter: line 171 column 5 (char 4660)
Traceback (most recent call last):
File "/Users/vunguyen/automation/customclient/tools/AppiumLibrary/init.py", line 4, in
from keywords import *
File "/Users/vunguyen/automation/customclient/tools/AppiumLibrary/keywords/init.py", line 11, in
from _account import _AccountKeywords
File "/Users/vunguyen/automation/customclient/tools/AppiumLibrary/keywords/_account.py", line 14, in
from base import base
File "/Users/vunguyen/automation/customclient/libs/pyLib/base.py", line 15, in
from GlobalVariables import *
File "/Users/vunguyen/automation/customclient/libs/pyLib/GlobalVariables.py", line 88, in
device_platform,device_port =get_json_file()
File "/Users/vunguyen/automation/customclient/libs/pyLib/GlobalVariables.py", line 79, in get_json_file
dev_info = json.load(json_file)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 290, in load
**kw)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 338, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
obj, end = self.scan_once(s, idx)
PYTHONPATH:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/robot/libraries
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
/Library/Frameworks/Python.framework/Versions/2.7/bin
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/robotframework_appiumlibrary-1.2.5-py2.7.egg
/Users/vunguyen/automation/customclient/tools/AppiumLibrary
/Users/vunguyen/automation/customclient/tools/AppiumLibrary/keywords
/Users/vunguyen/automation/customclient/tools/AppiumLibrary/locators
/Users/vunguyen/automation/customclient/tools/AppiumLibrary/utils
/Users/vunguyen/automation/customclient/libs/keywordsLib
/Users/vunguyen/automation/customclient/libs/pyLib
/Users/vunguyen/automation/customclient/libs/testSuites
/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/Library/Python/2.7/site-packages

No Keyword existing for executing JavaScript and getting text of element in appium library

I want to execute JavaScript for various action get text value, swipe, scroll. So is it possible to have keyword like 'Execute JavaScript'.
Also there is no keyword existing for getting text value of element because I want fetch text value of element.

eg:
execute_script("mobile: swipe", {"startX": 0.9, "startY": 0.9, "endX": 0.9, "endY": 0.9, "endY": 3.0})

"Page should contain element" fails if locator strategy (id/name/etc.) is missing

Page should contain element fails always with an AttributeError: 'module' object has no attribute 'escape_xpath_value' error

20150305 19:46:57.047 - INFO - +----- START KW: AppiumLibrary.Page Should Contain Element [ com.android.contacts:id/digits ]
20150305 19:46:57.725 - FAIL - AttributeError: 'module' object has no attribute 'escape_xpath_value'
20150305 19:46:57.725 - DEBUG - Traceback (most recent call last):
  File "", line 2, in page_should_contain_element
  File "C:\Python27\lib\site-packages\robotframework_appiumlibrary-1.2.4-py2.7.egg\AppiumLibrary\keywords\keywordgroup.py", line 14, in _run_on_failure_decorator
    return method(*args, **kwargs)
  File "C:\Python27\lib\site-packages\robotframework_appiumlibrary-1.2.4-py2.7.egg\AppiumLibrary\keywords\_element.py", line 112, in page_should_contain_element
    if not self._is_element_present(locator):
  File "C:\Python27\lib\site-packages\robotframework_appiumlibrary-1.2.4-py2.7.egg\AppiumLibrary\keywords\_element.py", line 272, in _is_element_present
    elements = self._element_finder.find(application, locator, None)
  File "C:\Python27\lib\site-packages\robotframework_appiumlibrary-1.2.4-py2.7.egg\AppiumLibrary\locators\elementfinder.py", line 28, in find
    return strategy(browser, criteria, tag, constraints)
  File "C:\Python27\lib\site-packages\robotframework_appiumlibrary-1.2.4-py2.7.egg\AppiumLibrary\locators\elementfinder.py", line 94, in _find_by_default
    return self._find_by_key_attrs(browser, criteria, tag, constraints)
  File "C:\Python27\lib\site-packages\robotframework_appiumlibrary-1.2.4-py2.7.egg\AppiumLibrary\locators\elementfinder.py", line 101, in _find_by_key_attrs
    xpath_criteria = utils.escape_xpath_value(criteria)
20150305 19:46:57.725 - INFO - +----- END KW: AppiumLibrary.Page Should Contain Element (678)

How to request addition of new keywords.

Hi, I've been using appium library for about a year, and I made some modifications to _element.py to add some keywords from selenium2. Kaywords that doesn't come by default.
How is the procedure to add this changes to the master.
I would like to share my modifications whit the comunity.
Thanks!

Unable to install the package in Python 3.4

Noticing below error in my Mac machine running OSX 10.9. Both setuptools & ez_setup package is installed

error: invalid command 'bdist_egg'

/private/var/folders/xz/j9r51m2j0z96s__wj_mv5cb40000gn/T/pycharm-packaging0.tmp/robotframework-appiumlibrary/distribute-0.6.14-py3.4.egg

Traceback (most recent call last):

  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ez_setup.py", line 143, in use_setuptools

    raise ImportError

ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "<string>", line 20, in <module>

  File "/private/var/folders/xz/j9r51m2j0z96s__wj_mv5cb40000gn/T/pycharm-packaging0.tmp/robotframework-appiumlibrary/setup.py", line 8, in <module>

    use_setuptools()

  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ez_setup.py", line 145, in use_setuptools

    return _do_download(version, download_base, to_dir, download_delay)

  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ez_setup.py", line 125, in _do_download

    _build_egg(egg, tarball, to_dir)

  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ez_setup.py", line 116, in _build_egg

    raise IOError('Could not build the egg.')

OSError: Could not build the egg.

keywords are too less for testing hybrid APP

Hi all, I have a idea.
AppiumLibrary has 51 keywords
Selenium2Library has 163 keywords
As wee all know, appium is a framework extended from selenium, so AppiumLibrary should have more selenium keywords

Developing all of the keywords is a very tedious work, besides, Selenium2Library has already implemented them. Why not consider combining the 2 library when we in test work?

If this is really valueable, I will provide a new keyword that making the 2 librarys work together and fork/pull a request.

"Wait Until Page Contains Element" status?

The Keyword documentation for Wait Until Page Contains states:
"...See also Wait Until Page Contains Element, Wait For Condition,Wait Until Element Is Visible..."

What's behind this statement?

  1. there should already be a keyword Wait Until Page Contains Element?
  2. there will be a keyword Wait Until Page Contains Element?
  3. copy-paste error, there are no plans for Keyword Wait Until Page Contains Element?

My test start in web view context,and then switch to the native app context.when switching from native app context back to web view context,the test goes wrong.

here the test code:
public void Test03_pan() throws InterruptedException{

    String origContext = driver.getContext();
    System.out.println(origContext);

    WebElement btnPan = driver.findElementById("btn-pan");
    btnPan.click();
    Thread.sleep(3000);


    System.out.println("start switch");
    driver.context("NATIVE_APP");
    String newContext = driver.getContext();
    System.out.println(newContext);


    driver.tap(1, 100, 400, 1000);
    driver.swipe(100, 400, 100, 500, 5000);

    System.out.println("switch back");
    driver.switchTo().window("WEBVIEW_1");
    String s = driver.getContext();
    System.out.println(s);

}

I have tried so much,but none worked.
Can I get your suggestions?
best regards.

pip install robotframework-appiumlibrary fails

The GitHub page for robotframework-appiumlibrary says to do:
pip install robotframework-appiumlibrary
but when I do this on my OS X 10.10.3 MacBook Pro I get an error as shown in the attached log.

Can't attach log "Something went really wrong, and we can’t process that file."
see following:
Downloading/unpacking robotframework-appiumlibrary
Getting page https://pypi.python.org/simple/robotframework-appiumlibrary/
Cleaning up...
Removing temporary dir /private/var/folders/9c/qg38_v_d5kd2jygfp8bw2v_c0000gp/T/pip_build_cmtaylor...
Exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 1177, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/index.py", line 194, in find_requirement
page = self._get_page(main_index_url, req)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/index.py", line 568, in _get_page
session=self.session,
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/index.py", line 670, in get_page
resp = session.get(url, headers={"Accept": "text/html"})
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 468, in get
return self.request('GET', url, *_kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/download.py", line 237, in request
return super(PipSession, self).request(method, url, *args, *_kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 456, in request
resp = self.send(prep, *_send_kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 559, in send
r = adapter.send(request, *_kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 327, in send
timeout=timeout
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 488, in urlopen
conn = self._get_conn(timeout=pool_timeout)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 222, in _get_conn
return conn or self._new_conn()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 683, in _new_conn
return self._prepare_conn(conn)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 647, in _prepare_conn
conn.connect()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connection.py", line 179, in connect
self._tunnel()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 745, in _tunnel
line = response.fp.readline(_MAXLINE + 1)
TypeError: readline() takes exactly 1 argument (2 given)

Switch Application keyword is not working properly with same UDID or device

I have executed below code on same device with UDID as 039d220c43819f72. In code I have opened two applications on different port and both applications are opened successfully. But when i switch application from 2->1 or 1>2 using 'Switch Application' keyword then application is not switched. Can anyone please suggest any way to resolve this issue.

${appium2} Open Application http://127.0.0.1:4755/wd/hub platformName=Android platformVersion=4.4.2 deviceName=Nexus5 automationName=appium udid=039d220c43819f72 appPackage=com.whatsapp appActivity=com.whatsapp.Main
${appium1} Open Application http://127.0.0.1:4723/wd/hub platformName=Android platformVersion=5.1.1 deviceName=Nexus5 automationName=appium udid=039d220c43819f72 appPackage=com.android.calculator2 appActivity=com.android.calculator2.Calculator
Capture Page Screenshot
Switch Application ${appium2}
Click Element id=com.whatsapp:id/menuitem_search
Switch Application ${appium1}

Go To Url keyword

Hi, I need help with Go To Url keyword.
I'm using it as documentation says: first, I open application (firefox for example), this step works fine.
But when I call Go To Url | www.google.com I get this error:

WebDriverException: Message: Not yet implemented.

Is there any other way to open an url in the browser on a real device?

Thanks!

Open android Firefox browser using Open Application

Hi, I am trayng to navigate to an url using the browser (i.e. firefox).
I am using keyword "go to url" after "open application" but I am getting this error:

WebDriverException: Message: Not yet implemented. Please help us: http://appium.io/get-involved.html

I am opening installed firefox using this capabilities:

platformName: Android
platformVersion: 4.4
browserName: android
androidPackage: org.mozilla.firefox
appActivity: org.mozilla.firefox.App
automationName: Appium
language: PT
locale: pt_BR
appiumVersion: 1.4.7

I'm sure the error I mention is thrown from "go to url"

I'll apresiate any hep, Thanks!

Syntax error in setup.py file

When I cloned this issue on my windows machine I could not install the package due to following syntax error:

Traceback (most recent call last):
File "setup.py", line 7, in
from ez_setup import use_setuptools
File "src\ez_setup.py", line 106
except pkg_resources.VersionConflict, e:
^
SyntaxError: invalid syntax

shake is throwing, 'message not implemented yet' on android

working with Android i am getting below error when trying to use keyword "Shake"

info: [debug] Responding to client that a method is not implemented
info: <-- POST /wd/hub/session/c2ff7fb7-7837-4830-95fd-c3fcf5a1a529/appium/device/shake 501 3.294 ms - 158

Can you please check, many thanks in advance.

confused with Open Application keyword/parameters and actual appium command line parameters

So I start my node.js appium application from the command line, and I am passing in these server arguments (I have a little run_appium.sh startup bash script):

#!/bin/bash
appium --address 127.0.0.1
--platform-name iOS \
--platform-version 7.1.1 \
--device-name "iPhone 5s" \
--udid b310634414abe73501a0fcb361b4455f7c1a312f \
--app <my_bundle_id>

But I also then need to, say in a resources.robot file, give my Open Application keyword the same values:

** Variables ***
${REMOTE_URL}  http://localhost:4723/wd/hub
${PLATFORM_NAME}  iOS
${PLATFORM_VERSION}  7.1.1
${DEVICE_NAME}  iPhone 5s
${APP}  <my_bundle_id>
${UDID}     b310634414abe73501a0fcb361b4455f7c1a312f

*** Keywords ***
TestStart
    [Documentation]  just demo
    Open Application  ${REMOTE_URL}  ${PLATFORM_NAME}  ${PLATFORM_VERSION}  ${DEVICE_NAME}  ${APP}  ${UDID}

Why do I need to have these settings in both places?

install error(pip install robotframework-appiumlibrary)

I use "pip install robotframework-appiumlibrary", I got some error:

No distributions matching the version for pytest-pythonpath>=0.4 (from robotframework-appiumlibrary)

Why?

I can use "pip install robotframework-appiumlibrary==1.0.22" to install 1.0.22 success.

pip.log:

Downloading/unpacking robotframework-appiumlibrary
Getting page https://pypi.python.org/simple/robotframework-appiumlibrary/
URLs to search for versions for robotframework-appiumlibrary:

Please add implicitly_wait

Hi jollychang,

I'm currently writing my first test case for an Android app by using your Appium library.
Unfortunately I'm experiencing some problems with the Page Should Contain Element keyword. It will only pass, if I add a Sleep 1s keyword before the assertion, because only then the app has finished with drawing the screen and only then the desired element is available.

To circumvent the additional Sleep keyword, I guess the Appium Python library provides the implicitly_wait functionality. Please could you add that feature to your library so it can be used within the Robotframework?

Thanks
Ben

Open Application argument error

Below is my resource file

*** Setting ***
Library AppiumLibrary run_on_failure=Close Application

*** Variable ***
${remote_url} http://localhost:4723/wd/hub
${platformName} iOS
${platformVersion} 7.1
${deviceName} iPhone 4s
${app} /Users/Mobile.app

*** Keyword ***
TestBill
[Documentation] Bill
#Open Application ${remote_url} ${platformName} ${deviceName} ${platformVersion} ${deviceName} ${app}
Open Application http://localhost:4723/wd/hub platformName=iOS platformVersion=7.1 deviceName=iPhone 4s app=/Users/Mobile.app

-This line works
Open Application http://localhost:4723/wd/hub platformName=iOS platformVersion=7.1 deviceName=iPhone 4s app=/Users/Mobile.app

-If i use this line
Open Application ${remote_url} ${platformName} ${deviceName} ${platformVersion} ${deviceName} ${app}
i am getting this error
"Keyword 'AppiumLibrary.Open Application' expected 1 to 2 non-keyword arguments, got 5."

It was working until i updated AppiumLibrary today

Cannot access element in webview

Hi. I'm pretty new with automated testing. I am trying to access divs inside a webview to click on element.
If I open the appium inspector, I can only see inside the webview the divs that contain text (they are identified as a UIAStaticText element). All others are ignored. Even if I try to access it regardless, using
Tap //div[@id='button']
it says the element does not exist. I precise I switch to WEBVIEW_1 before that.

text input: append and replace

An enhancement idea: I think it would be good to have possibility to replace a text in a text field with one keyword.
I.e. instead of

Clear Text   identifier = com.me.myApp:id/textField
Input Text   identifier = com.me.myApp:id/textField    ExampleText

do just

  1. Input Text identifier = com.me.myApp:id/textField ExampleText replace=True
    or
  2. Replace Text identifier = com.me.myApp:id/textField ExampleText

What do you think? Should I create a PR for this?
If yes, which option? I'd prefer 1)

One Keyword would make the execution faster and there already different methods for this on Appium side: send_keys() when appending and set_text() when replacing.

Keyword 'AppiumLibrary.Open Application' expected 1 to 2 non-keyword arguments

The test can run sccess on robotframework-appiumlibrary (1.0.22), but upgrade appiumlibrary to 1.2.0. then error:

==============================================================================
Open App                                                              | FAIL |
Keyword 'AppiumLibrary.Open Application' expected 1 to 2 non-keyword arguments,
got 5.
------------------------------------------------------------------------------

Test Script:

*** Settings ***
Library           AppiumLibrary

*** Variables ***
${REMOTE_URL}     http://localhost:4723/wd/hub
${PLATFORM_NAME}    Android
${PLATFORM_VERSION}    4.4.2
${DEVICE_NAME}    emulator-5554
${APP}            D:/asas.apk

*** Test Cases ***
Open App
    Open Application    ${REMOTE_URL}    ${PLATFORM_NAME}    ${PLATFORM_VERSION}    ${DEVICE_NAME}    ${APP}
    Sleep   10s 

element_should_be_disabled and element_should_be_enabled missing loglevel

When element should be disabled or element should be enabled fails it does not log the error. Instead it states global name loglevel is not defined.

The reason is its missing loglevel. It appears as def element_should_be_disabled(self, locator):

it should be def element_should_be_disabled(self, locator, loglevel='INFO')

Same for enabled keyword.

error happen on using pip to install appiumlibrary 1.2.0 on mac osX 10.10

command: pip install -U robotframework-appiumlibrary
error: Could not find a version that satisfies the requirement pytest-pythonpath>=0.4 (from robotframework-appiumlibrary) (from versions: 0.1, 0.2, 0.3)

I try to get pytest-pythonpath 0.4,but there is only 0.3 on pip, so I think there is a typo?

ScrollTo Functional 2

Scroll function is pretty awesome when all elements are present in view , and when they are not my problem begins.

AppiumLibrary.Scroll name=!, name=ForATTests
Documentation:

Scrolls from one element to another
Start / End / Elapsed: 20140806 13:34:26.299 / 20140806 13:34:32.455 / 00:00:06.156
13:34:32.455 FAIL WebDriverException: Message: u'An error occurred while executing user supplied JavaScript.'

debug: [INST] 2014-08-06 10:34:32 +0000 Debug: Running system command #95: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":17,"value":"point is not within the bounds of the screen"}...

I have next situation : i try to scroll list of files and folders on public ftp server, elements over there pretty dynamic , and only folder that i know is the one that i made before myself. So how can i scroll my app to my folder on a big ftp server with frequent updates ?

Appium library: Switch to Context throws an error I don't understand.

Hi.
I am new to appium.
I am implemeting RobotFramework+AppiumLibrary(1.0.19) to test my android native app.

I start the test, performing a login with a facebook user, and the app opens a webview for facebook login form.
So, in order to interact with the facebook web view I execute the keyword "Switch To Contex" with the name of the webview context:
Switch To Context | WEBVIEW_1

Then I perform the login to facebook.
When I finish this steps It supose the app is back in the native context, so I need to execute "Switch To Context" again with the parameter "NATIVE_APP".
At this point I am getting an error like this:

WebDriverException: Message: {"status": 6, "sessionId": "87ae2153a891498e80b026bed6d5c9bf", "value": ""}

I found that this is someting related with the webDriver, but I don't know how to solve it.

I'll apreciate any help!

Thanks!

the new argument "new_command_timeout" breaks the interface

The new argument new_command_timeout in Open Application should have a default value of None.

With the current default value =60 it is not possible to use the appium command line option --command-timeout anymore. I.e. starting appium with --command-timeout 120 has no effect, because the appium library always overrides the that 120 seconds with 60 seconds.
(and the default on appium side is anyway already 60secs i.e. starting appium without --command-timeout)

In Short:
instead of new_command_timeout=60 it should be new_command_timeout=None
and send it to appium only when provided

 if new_command_timeout:
        desired_caps['newCommandTimeout'] = new_command_timeout

Unable to send desired capabilities to saucelabs

I am unable to send desired capabilities to sauce labs. I would like to send it with the following command: Open Application ${REMOTE_URL} ${PLATFORM_NAME} ${PLATFORM_VERSION} ${DEVICE_NAME} ${APP}, but from looking at the documentation here ==> http://jollychang.github.io/robotframework-appiumlibrary/doc/AppimuLibrary.html#Open Application, i'm not seeing a way how to do so. The reason I need to send it, sauce labs requires me to specify the version of appium to use for app testing. Can you provide some insight into this, thanks.

desired_capabilities

To retain compatibility with robotframework selenium2library it would be nice to have the Open Application support the desired_capabilities dictionary.

Thank you.

"Open Application" Keyword "udid" argument issues

There a couple of issues with the udid argument in the Open Application Keyword:

  1. The documentation is incorrect, it states:
    "udid - UDID for iOS mobile device", this is not correct - the udid is also valid for android.
    It can be used to connect appoium to a specific device i.e.
    image
Open Application    http://127.0.0.1:5555/wd/hub ... udid=xxx
Open Application    http://127.0.0.1:6666/wd/hub ... udid=yyy

The first line of code connects to the device with the "udid=xxx" using the appium1 instance.
The second line of code connects to the device with the "udid=yyy" using the appium2 instance.

  1. The argument handling is also not 100% correct, if the Open Application call does not contain the udid the desiredCapabilities will be send with udid=null to appium and this confuses appium is certain scenarios --> udid should be added to desiredCapabilities only if the udid value is not null.
    I'd also do the same for all optional arguments in Open Application i.e. add them to desired capabilities only if the value is not null.

Just let me know, if you want me to create a PR for this.

Getting Elements Text Attribute

User activity -
I am trying to fetch the text of the Button or Label, and copy it to clipboard or temporary variable in my test script. This I cannot achieve using RF capability but can achieve through pythons appium client library.

Testing with multiple devices

This more a question than an issue:
Let's take an example test scenario: a messaging application with two devices:
step-1: type "hello world" in device-A.
step-2: verify in device-B that "hello world" is displayed.

Questions:

  1. Does this library support multiple devices?
  2. If not, any plans in adding such feature?

thanks in advance

cannot install/upgrade back to 1.0.20 after downgrading

To test my issues in #21, I did a sudo pip uninstall robotframework-appiumlibrary, then proceed to go back to 1.0.16 via sudo pip install robotframework-appiumlibrary==1.0.16.

Now I want to go back to the latest (1.0.20). So, I did a sudo pip uninstall robotframework-appiumlibrary followed by, of course, sudo pip install robotframework-appiumlibrary.

Now I get the following when trying to run pybot.

=============================================================================
Sandbox :: demo for appium library                                            
==============================================================================
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No application is open
test_demo                                                             | FAIL |
NameError: global name 'appium' is not defined

If I do another uninstall, and then do sudo pip install robotframework-appiumlibrary==1.0.19, I am fine, it works. If I try to install over this as an upgrade to try and get back to 1.0.20, I get the same error. I can now no longer get 1.0.20 installed no matter what I do. If I uninstall, then try to just install the latest at this point, 1.0.20 never works, I get the above error.

Xpath locator doesn't work for Click Element

I am trying to click element which doesn't work with xpath locator.
I want to find one element and click on other relative to that.
Is there any work around for this (like we do for WebApp "//node/..")??
Please help!!

Wait Until Page Contains fails

Wait Until Page Contains   Some Text

fails with

AttributeError: 'AppiumLibrary' object has no attribute '_timeout_in_secs'

Selendroid gestures keyword

Hello,
I thank you again very much for your work and your implication in this library.
And your reactivity also, which I must say is quite amzaing :)

I have another request for a future release.
I can start the Appium session in Selendroid mode with the library; using the argument "automation name = selendroid" within the Open Application keyword.

However, when in Selendroid mode, the mobile gestures keywords are no longer recognized since it is the selendroid server that does the work.

My request is the following : could it be possible to implement the keyword "Flick" that would match the selendroid keyword ?
It is defined in the appium python client in the following file :
appium/webdriver/webdriver.py

Thank you again for you time and efforts,
AndrΓ©a

Compatible with Appium 1.x?

Greetings!

We have a large existing codebase using Appium 0.18.2 along with Robot Framework and the Selenium2Library. The testing centers around an Android wrapped application, but the switch to webview fails when run against Appium 1.x. I understand that we should now be importing webdriver from appium rather than from selenium, and that switching to webview now relies upon code that is specific to appium.webdriver.

Does your library support Appium 1.x? If so, is there a way I could open the session and switch to webview with your library, and then hand it off to Selenium2Library?

Selectors are broken with Selenium 2.46.1

I have tried id selector with selenium 2.46.1, something is diffrent and id directs to css selector.
This breaks appium execution as it tries to parse css selector instead of id

Install APK on real device with appium in RF

There is no such a keyword in appium library of RF(Robot Framework) to install or Uninstall apk on the real devices. Do we have any method in appium to do the same? any example?

With the help of Android library its easy but i am looking solution for appium.

Any help will be appreciated... :-)

"run_on_failure=Nothing" does not work

Importing section of the documentation and the Register Keyword To Run On Failure method description use Nothing to run no keywords on failure.

But when I use Nothing I keep getting no such keyword errors --> I'm now using No Operation instead, which is not exactly the same thing

  • with Nothing I would expect that no Keyword is called
  • with No Operation a Keyword that does nothing is called

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.