Giter Site home page Giter Site logo

luisxiaomai / robotframework-anywherelibrary Goto Github PK

View Code? Open in Web Editor NEW
65.0 13.0 37.0 895 KB

AnywhereLibrary is a cross platform(desktop browser,Android,iOS) testing library for Robot Framework that leverages the [Selenium 2(WebDriver)] libraries internally to control a web browser and [appium] as mobile test automation framework for use with native and hybrid app.

License: MIT License

Objective-C 16.67% Python 83.33%
robot-framework appium webdriver python

robotframework-anywherelibrary's Introduction

PyPI version Build status codecov Join the chat at https://gitter.im/anywherelibrary/Lobby GitHub license

Introduction

AnywhereLibrary is a cross platform (desktop browser, Android, iOS) testing library for Robot Framework that leverages the Selenium 2 (WebDriver) libraries internally to control a web browser and Appium as mobile test automation framework for use with native and hybrid apps.

This library is especially suitable for handling SPA (single-page apps) with responsive design patterns. With this you only need to generate a set of scripts to cover all platforms (desktop browser, Android, iOS).

On the other hand, not any UI test automation framework is made for your real business. If this library isn't suitable for your business, it's highly recommended that you fork this repository as a prototype for UI test automation. Customize your own AnywhereLibrary in accordance to your actual business requirements.

Installation

python3 setup.py install

Directory Layout

doc/

Keyword documentation.

sample-code/

A sample test case which can run in desktop browser, sample Android and iOS webview apps with different platform parameter inputs.

src/base

Python source code.

src/cfg

Configuration file which stores all parameters for initializing the driver.

Usage

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

As it uses Appium for its mobile solution, please make sure your Appium server is up and running. For how to use Appium, please refer to the Appium Documentation.

Before Running the Test Case

You must use the Initial Driver keyword with platform value as the parameter input; after the test case you must use Tear Down Driver keyword to tear down the related driver. Also you need to do some modifications in configuration.xml file in /AnywhereLibrary/cfg.

Locating elements

All keywords in AnywhereLibrary that need to find an element on the page take an argument, locator. AnywhereLibrary supports a subset of the WebDriver locator strategies. Currently available locator strategies are:

find by "class" (i.e., ui component type)
find by "xpath" (i.e., an abstract representation of a path to an element, with certain constraints)

Supported strategies are:

Strategy Example Description
xpath Click //div[@id='my_element']
xpath Click xpath=//div[@id='my_element']
class Click class=android.widget.Button
... Coming soon... Coming soon...

Running Sample Cases

pybot --variable platform:chrome webviewTest.txt
pybot --variable platform:firefox webviewTest.txt
pybot --variable platform:iphone webviewTest.txt

Documentation

Keywords at a Glance:

  • Initial Driver
  • Tear Down Driver
  • Click
  • Type
  • Element Find
  • Get Text
  • Get Value
  • Verify Text
  • Verify Value
  • Is Element Present
  • Page Should Contain Element
  • Page Should Not Contains Element
  • Wait For Element Present
  • Wait No Such Element Present
  • Switch To Native
  • Switch To Webview
  • Capture Page Screenshot
  • Execute Javascript
  • mobile gestures
    • Coming Soon...

More details about keyword documentation could be found at Keyword Documentation

Plan

  • Add more keywords.

FAQ

TODO

License

robotframework-anywherelibrary's People

Contributors

duskmushroom avatar gitter-badger avatar glmeece avatar luisxiaomai 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

Watchers

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

robotframework-anywherelibrary's Issues

Robot Anywhere isn't installing on ubuntu

Hello Luis, could you take a look on it? It will be very help if it works. Thank you.

pip install robotframework-anywherelibrary
Collecting robotframework-anywherelibrary
Using cached https://files.pythonhosted.org/packages/15/d6/9e451411d3f0205510aad027f07a831e3da314ff526c739db2da23c640ed/robotframework-anywherelibrary-1.1.0.tar.gz
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-x4xzkoxs/robotframework-anywherelibrary/setup.py'"'"'; file='"'"'/tmp/pip-install-x4xzkoxs/robotframework-anywherelibrary/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-x4xzkoxs/robotframework-anywherelibrary/pip-egg-info
cwd: /tmp/pip-install-x4xzkoxs/robotframework-anywherelibrary/
Complete output (5 lines):
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-x4xzkoxs/robotframework-anywherelibrary/setup.py", line 8, in
execfile(join(dirname(file), 'src', 'AnywhereLibrary', 'version.py'))
NameError: name 'execfile' is not defined
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

模块导入错误

原:\Python27\lib\site-packages\AnywhereLibrary\base\waiting.py", line 3, in
from AnywhereLibrary.base import elementfinder as EC
修改为
\Python27\lib\site-packages\AnywhereLibrary\base\waiting.py", line 3, in
from AnywhereLibrary.base.elementfinder import ElementFinder as EC

日志路径设置出错

报错:FAILED AnywhereLibrary Importing test library 'AnywhereLibrary' failed: ImportError: cannot import name GLOBAL_VARIABLES
出错处:\Python27\lib\site-packages\AnywhereLibrary\base\logging.py", line 2, in
from robot.variables import GLOBAL_VARIABLES
改为:

from robot.libraries.BuiltIn import BuiltIn
def _get_log_dir(self):
        try:
            variables = BuiltIn().get_variables()

            logfile = variables['${LOG FILE}']
            if logfile != 'NONE':
                return os.path.dirname(logfile)
            return variables['${OUTPUTDIR}']

        except RobotNotRunningError:
            return os.getcwd()

AttributeError: 'NoneType' object has no attribute 'save_screenshot'

i am getting this error when trying to execute sample webviewTest.txt. Firefox opens but quits unexpectedly. attached logs.Could you please help me.

$ pybot --variable platform:firefox webviewTest.txt

webviewTest

[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: AttributeError: 'NoneType' object has no attribute 'save_screenshot'
Search "robotframework-anywherelibrary" in google | FAIL |
Parent suite setup failed:

error: [Errno 61] Connection refused

[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: AttributeError: 'NoneType' object has no attribute 'save_screenshot'
webviewTest | FAIL |
Suite setup failed:
error: [Errno 61] Connection refused

Also suite teardown failed:
AttributeError: 'NoneType' object has no attribute 'quit'

1 critical test, 0 passed, 1 failed
#1 test total, 0 passed, 1 failed

Importing AnywhereLibrary in a test Suite failed

I would like to use this Library to write automated tests on desktop, iOS and Android.
But importing the library fails because this library is using GLOBAL_VARIABLES which is not supported in latest Robotframework versions 2.8.2 and higher...
I am using the latest Robotframework version 3.0

RIDE Error log is as follows:

20170202 11:13:13.126 [WARN]: Importing test library "AnywhereLibrary" failed

Traceback (most recent call last):
Importing test library 'AnywhereLibrary' failed: ImportError: cannot import name GLOBAL_VARIABLES
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\robotide\lib\robot\utils\importer.py", line 143, in import
return import(name, fromlist=fromlist)
File "C:\Python27\lib\site-packages\AnywhereLibrary_init
.py", line 1, in
from base import *
File "C:\Python27\lib\site-packages\AnywhereLibrary\base_init_.py", line 3, in
from logging import Logging
File "C:\Python27\lib\site-packages\AnywhereLibrary\base\logging.py", line 2, in
from robot.variables import GLOBAL_VARIABLES
PYTHONPATH:
C:\Python27\lib\site-packages\wx-2.8-msw-unicode
C:\Python27\lib\site-packages\wx-2.8-msw-unicode
C:\Python27\Scripts
C:\Python27\lib\site-packages\robotframework-3.0-py2.7.egg
C:\Python27\lib\site-packages\decorator-3.3.2-py2.7.egg
C:\Python27\lib\site-packages\selenium-2.53.2-py2.7.egg
C:\Windows\system32\python27.zip
C:\Python27\DLLs
C:\Python27\lib
C:\Python27\lib\plat-win
C:\Python27\lib\lib-tk
C:\Python27
C:\Python27\lib\site-packages
C:\Python27\lib\site-packages\robotide\spec
File "C:\Python27\lib\site-packages\robotide\spec\librarymanager.py", line 81, in _fetch_keywords
return get_import_result(path, library_args)
File "C:\Python27\lib\site-packages\robotide\spec\libraryfetcher.py", line 20, in get_import_result
lib = robotapi.TestLibrary(path, args)
File "C:\Python27\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 46, in TestLibrary
return_source=True)
File "C:\Python27\lib\site-packages\robotide\lib\robot\utils\importer.py", line 67, in import_class_or_module
self._raise_import_failed(name, err)
File "C:\Python27\lib\site-packages\robotide\lib\robot\utils\importer.py", line 103, in _raise_import_failed
raise DataError('\n'.join(msg))

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.