Git Product home page Git Product logo

python-client's Introduction

Appium Python Client

PyPI version Downloads

Build Status

Code style: black

An extension library for adding WebDriver Protocol and Appium commands to the Selenium Python language binding for use with the mobile testing framework Appium.

Getting the Appium Python client

There are three ways to install and use the Appium Python client.

  1. Install from PyPi, as 'Appium-Python-Client'.

    pip install Appium-Python-Client

    You can see the history from here

  2. Install from source, via PyPi. From 'Appium-Python-Client', download and unarchive the source tarball (Appium-Python-Client-X.X.tar.gz).

    tar -xvf Appium-Python-Client-X.X.tar.gz
    cd Appium-Python-Client-X.X
    python setup.py install
  3. Install from source via GitHub.

    git clone [email protected]:appium/python-client.git
    cd python-client
    python setup.py install

Compatibility Matrix

Appium Python Client Selenium binding Python version
3.0.0+ 4.12.0+ 3.8+
2.10.0 - 2.11.1 4.1.0 - 4.11.2 3.7+
2.2.0 - 2.9.0 4.1.0 - 4.9.0 3.7+
2.0.0 - 2.1.4 4.0.0 3.7+
1.0.0 - 1.3.0 3.x 3.7+
0.52 and below 3.x 2.7, 3.4 - 3.7

The Appium Python Client depends on Selenium Python binding, thus the Selenium Python binding update might affect the Appium Python Client behavior. For example, some changes in the Selenium binding could break the Appium client.

Note We strongly recommend you manage dependencies with version management tools such as Pipenv and requirements.txt to keep compatible version combinations.

Quick migration guide from v3 to v4

Quick migration guide from v2 to v3

  • options keyword argument in the webdriver.Remote constructor such as XCUITestOptions instead of desired_capabilities
  • Replacement
    • start_activity method: Please use mobile: startActivity
    • launch_app, close_app and reset methods: Please refer to appium/appium#15807
    • available_ime_engines, is_ime_active, activate_ime_engine, deactivate_ime_engine and active_ime_engine methods: Please use mobile: shell
    • set_value and set_text methods: Please use element.send_keys or send_keys by W3C Actions
  • Removal
    • end_test_coverage method is no longer available
    • session property is no longer available
    • all_sessions property is no longer available

Quick migration guide from v1 to v2

  • Enhancement
    • Updated base Selenium Python binding version to v4
      • Removed forceMjsonwp since Selenium v4 and Appium Python client v2 expect only W3C WebDriver protocol
    • Methods ActionHelpers#scroll, ActionHelpers#drag_and_drop, ActionHelpers#tap, ActionHelpers#swipe and ActionHelpers#flick now call W3C actions as its backend
      • Please check each behavior. Their behaviors could slightly differ.
    • Added strict_ssl to relax SSL errors such as self-signed ones
  • Deprecated
    • MultiAction and TouchAction are deprecated. Please use W3C WebDriver actions or mobile: extensions
    • launch_app, close_app, and reset are deprecated. Please read issues#15807 for more details

MultiAction/TouchAction to W3C actions

On UIA2, some elements can be handled with touch pointer action instead of the default mouse pointer action in the Selenium Python client. For example, the below action builder is to replace the default one with the touch pointer action.

from selenium.webdriver import ActionChains
from selenium.webdriver.common.actions import interaction
from selenium.webdriver.common.actions.action_builder import ActionBuilder
from selenium.webdriver.common.actions.pointer_input import PointerInput

actions = ActionChains(driver)
# override as 'touch' pointer action
actions.w3c_actions = ActionBuilder(driver, mouse=PointerInput(interaction.POINTER_TOUCH, "touch"))
actions.w3c_actions.pointer_action.move_to_location(start_x, start_y)
actions.w3c_actions.pointer_action.pointer_down()
actions.w3c_actions.pointer_action.pause(2)
actions.w3c_actions.pointer_action.move_to_location(end_x, end_y)
actions.w3c_actions.pointer_action.release()
actions.perform()

Usage

The Appium Python Client is fully compliant with the WebDriver Protocol including several helpers to make mobile testing in Python easier.

To use the new functionality now, and to use the superset of functions, instead of including the Selenium webdriver module in your test code, use that from Appium instead.

from appium import webdriver

From there much of your test code will work with no change.

As a base for the following code examples, the following set up the UnitTest environment:

# Python/Pytest
import pytest

from appium import webdriver
# Options are only available since client version 2.3.0
# If you use an older client then switch to desired_capabilities
# instead: https://github.com/appium/python-client/pull/720
from appium.options.android import UiAutomator2Options
from appium.options.ios import XCUITestOptions
from appium.webdriver.appium_service import AppiumService
from appium.webdriver.common.appiumby import AppiumBy

APPIUM_PORT = 4723
APPIUM_HOST = '127.0.0.1'


# HINT: fixtures below could be extracted into conftest.py
# HINT: and shared across all tests in the suite
@pytest.fixture(scope='session')
def appium_service():
    service = AppiumService()
    service.start(
        # Check the output of `appium server --help` for the complete list of
        # server command line arguments
        args=['--address', APPIUM_HOST, '-p', str(APPIUM_PORT)],
        timeout_ms=20000,
    )
    yield service
    service.stop()


def create_ios_driver(custom_opts = None):
    options = XCUITestOptions()
    options.platformVersion = '13.4'
    options.udid = '123456789ABC'
    if custom_opts is not None:
        options.load_capabilities(custom_opts)
    # Appium1 points to http://127.0.0.1:4723/wd/hub by default
    return webdriver.Remote(f'http://{APPIUM_HOST}:{APPIUM_PORT}', options=options)


def create_android_driver(custom_opts = None):
    options = UiAutomator2Options()
    options.platformVersion = '10'
    options.udid = '123456789ABC'
    if custom_opts is not None:
        options.load_capabilities(custom_opts)
    # Appium1 points to http://127.0.0.1:4723/wd/hub by default
    return webdriver.Remote(f'http://{APPIUM_HOST}:{APPIUM_PORT}', options=options)


@pytest.fixture
def ios_driver_factory():
    return create_ios_driver


@pytest.fixture
def ios_driver():
    # prefer this fixture if there is no need to customize driver options in tests
    driver = create_ios_driver()
    yield driver
    driver.quit()


@pytest.fixture
def android_driver_factory():
    return create_android_driver


@pytest.fixture
def android_driver():
    # prefer this fixture if there is no need to customize driver options in tests
    driver = create_android_driver()
    yield driver
    driver.quit()


def test_ios_click(appium_service, ios_driver_factory):
    # Usage of the context manager ensures the driver session is closed properly
    # after the test completes. Otherwise, make sure to call `driver.quit()` on teardown.
    with ios_driver_factory({
        'appium:app': '/path/to/app/UICatalog.app.zip'
    }) as driver:
        el = driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value='item')
        el.click()


def test_android_click(appium_service, android_driver_factory):
    # Usage of the context manager ensures the driver session is closed properly
    # after the test completes. Otherwise, make sure to call `driver.quit()` on teardown.
    with android_driver_factory({
        'appium:app': '/path/to/app/test-app.apk',
        'appium:udid': '567890',
    }) as driver:
        el = driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value='item')
        el.click()

Direct Connect URLs

If your Selenium/Appium server decorates the new session capabilities response with the following keys:

  • directConnectProtocol
  • directConnectHost
  • directConnectPort
  • directConnectPath

Then python client will switch its endpoint to the one specified by the values of those keys.

from appium import webdriver
# Options are only available since client version 2.3.0
# If you use an older client then switch to desired_capabilities
# instead: https://github.com/appium/python-client/pull/720
from appium.options.ios import XCUITestOptions

# load_capabilities API could be used to
# load options mapping stored in a dictionary
options = XCUITestOptions().load_capabilities({
    'platformVersion': '13.4',
    'deviceName': 'iPhone Simulator',
    'app': '/full/path/to/app/UICatalog.app.zip',
})

driver = webdriver.Remote(
    # Appium1 points to http://127.0.0.1:4723/wd/hub by default
    'http://127.0.0.1:4723',
    options=options,
    direct_connection=True
)

Relax SSL validation

strict_ssl option allows you to send commands to an invalid certificate host like a self-signed one.

from appium import webdriver
# Options are only available since client version 2.3.0
# If you use an older client then switch to desired_capabilities
# instead: https://github.com/appium/python-client/pull/720
from appium.options.common import AppiumOptions

options = AppiumOptions()
options.platform_name = 'mac'
options.automation_name = 'safari'
# set_capability API allows to provide any custom option
# calls to it could be chained
options.set_capability('browser_name', 'safari')

# Appium1 points to http://127.0.0.1:4723/wd/hub by default
driver = webdriver.Remote('http://127.0.0.1:4723', options=options, strict_ssl=False)

Set custom AppiumConnection

The first argument of webdriver.Remote can set an arbitrary command executor for you.

  1. Set init arguments for the pool manager Appium Python client uses to manage HTTP requests.
from appium import webdriver
from appium.options.ios import XCUITestOptions

import urllib3
from appium.webdriver.appium_connection import AppiumConnection

# Retry connection error up to 3 times.
init_args_for_pool_manage = {
    'retries': urllib3.util.retry.Retry(total=3, connect=3, read=False)
}
appium_executor = AppiumConnection(
    remote_server_addr='http://127.0.0.1:4723',
    init_args_for_pool_manage=init_args_for_pool_manage
)

options = XCUITestOptions()
options.platformVersion = '13.4'
options.udid = '123456789ABC'
options.app = '/full/path/to/app/UICatalog.app.zip'
driver = webdriver.Remote(appium_executor, options=options)
  1. Define a subclass of AppiumConnection
from appium import webdriver
from appium.options.ios import XCUITestOptions

from appium.webdriver.appium_connection import AppiumConnection

class CustomAppiumConnection(AppiumConnection):
    # Can add your own methods for the custom class
    pass

custom_executor = CustomAppiumConnection(remote_server_addr='http://127.0.0.1:4723')

options = XCUITestOptions().load_capabilities({
    'platformVersion': '13.4',
    'deviceName': 'iPhone Simulator',
    'app': '/full/path/to/app/UICatalog.app.zip',
})
driver = webdriver.Remote(custom_executor, options=options)

Documentation

Development

  • Code Style: PEP-0008
    • Apply black, isort and mypy as pre commit hook
    • Run make command for development. See make help output for details
  • Docstring style: Google Style
  • gitchangelog generates CHANGELOG.rst

Setup

  • pip install --user pipenv
  • python -m pipenv lock --clear
    • If you experience Locking Failed! unknown locale: UTF-8 error, then refer pypa/pipenv#187 to solve it.
  • python -m pipenv install --dev --system
  • pre-commit install

Run tests

You can run all of the tests running on CI via tox in your local.

$ tox

You also can run particular tests like below.

Unit

$ pytest test/unit

Run with pytest-xdist

$ pytest -n 2 test/unit

Functional

$ pytest test/functional/ios/search_context/find_by_ios_class_chain_tests.py

In parallel for iOS

  1. Create simulators named 'iPhone X - 8100' and 'iPhone X - 8101'
  2. Install test libraries via pip, pip install pytest pytest-xdist
  3. Run tests
$ pytest -n 2 test/functional/ios/search_context/find_by_ios_class_chain_tests.py

Release

Follow the below steps.

$ pip install twine
$ pip install git+git://github.com/vaab/gitchangelog.git # Getting via GitHub repository is necessary for Python 3.7
# Type the new version number and 'yes' if you can publish it
# You can test the command with DRY_RUN
$ DRY_RUN=1 ./release.sh
$ ./release.sh # release

License

Apache License v2

python-client's People

Contributors

akulavenkatesh avatar bayandin avatar benzhou29 avatar bootstraponline avatar dependabot-preview[bot] avatar dependabot[bot] avatar dor-bl avatar dpgraham avatar emil-petersen avatar eyjhb avatar iamnrupesh avatar ianxiaohanxu avatar imurchie avatar jatalahd avatar jlipps avatar jonahss avatar kazucocoa avatar ki4070ma avatar manoj9788 avatar mykola-mokhnach avatar pr4bh4sh avatar rajeshkumarayyadurai avatar salehbigdeli avatar srinivasantarget avatar tadashi0713 avatar urtow avatar venkateshps avatar vladimirpodolian avatar wkplus avatar wrrngncode 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  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

python-client's Issues

WebDriver.tap fails on button when using one position and no duration

I'm trying to press a button by coordinates,with a command like

driver.tap([(x,y)])

But the button is not pressed. If I make enable the pointer location in the device development options I see that the initial position of the press is in the button, but then i see a line to the center of the screen and it is released there, so the button action is not executed.

I think that Webdriver.tap should send x and y
action.press(x=x, y=y).release()

Also, TouchAction.release should allow setting the optional release coordinates, instead of always sending the empty dictionary

def release(self):
"""End the action by lifting the pointer off the screen
"""
self._add_action('release', {})

set_value method can not used

in my script:
...
textfields = self.driver.find_elements_by_class_name("android.widget.EditText")
self.driver.set_value(textfields[0],"abcd")

error msg:
WebDriverException: Message: u"ERROR running Appium command: Object [object Object] has no method 'setValueImmediate'"

appium log:
debug: Request received with params: {"sessionId":"e54cee4e-efa2-ecfa-210b-ba615feee53f","elementId":"bc02b4b5-4779-124d-0c44-2c71a5dbf247","value":["abcd"]}
TypeError: Object [object Object] has no method 'setValueImmediate'
at exports.setValueImmediate (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/server/controller.js:933:16)
at callbacks (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:164:37)
at param (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:138:11)
at param (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:135:11)
at param (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:135:11)
at pass (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:145:5)
at nextRoute (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:100:7)
at callbacks (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:167:11)
at exports.sessionBeforeFilter (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/server/controller.js:56:5)
at callbacks (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:164:37)

info: Shutting down appium session...

enhance the start_activity() in webdriver.py

It would be good to support also other Android specific capabilities in the start_activity() method. E.g. intentAction and intentCategory.
Maybe just add **kwargs to the arguments i.e.
def start_activity(self, app_package, app_activity, app_wait_package='', app_wait_activity='', **kwargs)

Cleartext not working on android

HI team,
I wanted to check login in my app two times, one for right credentials and one for wrong credentials.
when i click on element for second time and try to clear text, previously entered text is not cleared.

driver.contexts crashes Appium

driver.contexts

Traceback (most recent call last):
File "<pyshell#17>", line 1, in
driver.contexts
File "build/bdist.macosx-10.9-intel/egg/appium/webdriver/webdriver.py", line 57, in contexts
return self.execute(Command.CONTEXTS)['value'];
File "/Library/Python/2.7/site-packages/selenium-2.41.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 164, in execute
response = self.command_executor.execute(driver_command, params)
File "/Library/Python/2.7/site-packages/selenium-2.41.0-py2.7.egg/selenium/webdriver/remote/remote_connection.py", line 347, in execute
return self._request(command_info[0], url, body=data)
File "/Library/Python/2.7/site-packages/selenium-2.41.0-py2.7.egg/selenium/webdriver/remote/remote_connection.py", line 415, in _request
resp = opener.open(request)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1214, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1187, in do_open
r = h.getresponse(buffering=True)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1045, in getresponse
response.begin()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 409, in begin
version, status, reason = self._read_status()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 373, in _read_status
raise BadStatusLine(line)
BadStatusLine: ''

error: uncaughtException: connect ECONNREFUSED date=Wed Apr 30 2014 17:40:06 GMT+0300 (EEST), pid=93175, uid=501, gid=20, cwd=/Applications/Appium.app/Contents/Resources/node_modules/appium, execPath=/Applications/Appium.app/Contents/Resources/node/bin/node, version=v0.10.26, argv=[/Applications/Appium.app/Contents/Resources/node/bin/node, /Applications/Appium.app/Contents/Resources/node_modules/appium/lib/server/main.js, --address, 127.0.0.1, --port, 4723, --udid, auto, --session-override, --keep-artifacts, --native-instruments-lib, --calendar, gregorian, --language, en, --locale, en_US, --orientation, PORTRAIT], rss=15826944, heapTotal=35255040, heapUsed=23860384, loadavg=[1.607421875, 1.4375, 1.44677734375], uptime=3803283, trace=[column=11, file=net.js, function=errnoException, line=904, method=null, native=false, column=19, file=net.js, function=Object.afterConnect [as oncomplete], line=895, method=afterConnect [as oncomplete], native=false], stack=[Error: connect ECONNREFUSED, at errnoException (net.js:904:11), at Object.afterConnect as oncomplete]

Application under test was running in native mode.
Appium 0.18.0

Re-add 'keyevent' temporarily

I upgraded to the latest python-client and now the tests are broken, since keyevent was renamed to press_keycode, but the relevant change to appium is not released.
I guess we could re-add keyevent that still uses the deprecated keyevent on the appium side and retire it when a new appium is released.

MultiTouch MultiTap actions do not work as expected

The following code does not work as expected:

    mainWindow = self._find_element("//UIAApplication[1]/UIAWindow[1]")
    multi = MultiAction(self.driver)

    a1 = TouchAction(self.driver)
    a1.tap(mainWindow, 100, 300, count=4)

    a2 = TouchAction(self.driver)
    a2.tap(mainWindow, 200, 300, count=4)

    a3 = TouchAction(self.driver)
    a3.tap(mainWindow, 300, 300, count=4)

    multi.add(a1, a2, a3)
    multi.perform()

It sends the following:

   info: [debug] Sending command to instruments: target.touch([{"time":0.2,"touch":[{"x":100,"y":300},{"x":200,"y":300},{"x":300,"y":300}]}])

I was expecting the following:

     target.tapWithOptions({"tapOffset":{"x":0.3125,"y":0.528169014084507},"tapCount":4,"touchCount":1})

Is there a way to find a child element in another element?

Our team use the webdriver to develop the Android UI automation. We found it is hard to find the child element in another element.
For example, the following picture is from a list. The button at the right shows the status of this item.
default

In our test case, we want to find the item first then check the status of the right button. We can find this list item by the text. But we don't know how to find the button in the item. Is there a way to search the child element in another element? Could any one kindly help me out?

Getting following error for webdriver: selenium.common.exceptions.WebDriverException: Message: 'That URL did not map to a valid JSONWP resource'

I am trying to run appium script to automate Android app. I don't know where it is going wrong.

Script:
desired_caps = {}
desired_caps['appium-version'] = '1.0'
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.4'
desired_caps['deviceName'] = 'abc'
desired_caps['app'] = os.path.abspath('/Users/vikas/Documents/Something/Android/SomethingMobile.apk')
desired_caps['appActivity'] = 'com.something.mobile.SomethingSplash'
desired_caps['appPackage'] = 'com.Something.mobile'
desired_caps['avd'] = 'abc'
self.driver = webdriver.Remote('http://0.0.0.0:4723/wd/hub/', desired_caps)

Server response is:
info: --> POST /wd/hub//session {"desiredCapabilities":{"deviceName":"abc","appium-version":"1.0","app":"/Users/vikas/Documents/something/Android/SomethingMobile.apk","platformVersion":"4.4","avd":"abc","appPackage":"com.something.mobile","platformName":"Android","appActivity":"com.something.mobile.SomethingSplash"}}
info: [debug] Responding to client that we did not find a valid resource
info: <-- POST /wd/hub//session 404 0.709 ms - 47

Problem with setUp method

Hello dear maintainers of python-client,

So i am kind of new to appium and having an issue.
I installed and launched the server, and i have written a script based on the simple ios test python example in the appium repo.

my setUp method is the first method in my class that has been derived from unittest.TestCase

def setUp(self):
        # set up appium
        app = os.path.join(os.path.dirname(__file__), 'iOS SDK Test.app')
        app = os.path.abspath(app)
        desired_caps = {}
        desired_caps['platformName'] = 'ios'
        desired_caps['platformVersion'] = '7.1'
        desired_caps['device'] = 'iPhone Simulator'
        desired_caps['deviceName'] = 'iPhone Retina (4-inch 64-bit)'
        desired_caps['app'] = app

        self.driver = webdriver.Remote('http://0.0.0.0:4723/wd/hub', desired_caps)

So when i launch the script that contains this method, nothing happens i get the default 'run 0 tests with blabla' output.
When i put the inside of this method out of the classes scope tho it works the simulator with the app launches but than again it is outside of the scope of the test class.

I have tried the same caps with the simple ruby script and it works over there..

Could you please englighten me either i am doing something wrong or this is an issue with the python client.

Update HideKeyboard

Now you may pass:

For backward compatibility
hide_keyboard {} ~ tapOutside
hide_keyboard {keyName: }

New:
hide_keyboard {strategy: , key: }
For instance
hide_keyboard {strategy: "pressKey", key: "Done"}
hide_keyboard {strategy: "tapOutside"}

Session can't be created

the package name is com.automationsolutionz.sunshine.app
the main activity name is com.automationsolutionz.sunshine.app.MainActivity

def setup(**kwargs):
    desired_caps={}
    for each in kwargs:
        desired_caps[each]=kwargs[each]
    android_driver=webdriver.Remote(hub_path,desired_caps)
    return android_driver
def main():
    setup(platformName = 'Android',platformVersion = '4.2',deviceName ='F4AZCY05A885',appPackage='com.automationsolutionz.sunshine.app',appActivity='MainActivity')

But calling this giving me an error:
selenium.common.exceptions.WebDriverException: Message: A new session could not be created. (Original error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity)

but when I run from the adb shell:

adb -s F4AZCY05A885 shell am start -W -a android.intent.action.MAIN -n com.automationsolutionz.sunshine.app/.MainActivity

then it runs successfully.
Any help??

Question: How to get the accessibility identifier from apk.

Appium have a feature: FindElementByAccessibilityId(selector). But how to get the AccessibilityId from APK. I try to get the UI Structure through Appium API
For example:
android.widget.ImageButton index="0" text="" resource-id="" class="android.widget.ImageButton" package="com.hp.android.printlibtestapp" content-desc="More options" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[264,25][320,73]" instance="0"

I am not sure which attribute can be used as AccessibilityId.

Thanks for any suggestion.

webelement.rect cause WebDriverException: Message: That URL did not map to a valid JSONWP resource

Error
Traceback (most recent call last):
File "/home/purplek/Programming/python/appium/JDTest.py", line 34, in test
self.searchProduct('test')
File "/home/purplek/Programming/python/appium/JDTest.py", line 42, in search
self.getSearchList(1)
File "/home/purplek/Programming/python/appium/JDTest.py", line 48, in getList
start_item = search_items[0].rect
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 367, in rect
return self._execute(Command.GET_ELEMENT_RECT)['value']
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 404, in _execute
return self._parent.execute(command, params)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 195, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/appium/webdriver/errorhandler.py", line 29, in check_response
raise wde
WebDriverException: Message: That URL did not map to a valid JSONWP resource

"start_item = search_items[0].rect" cause WebDriverException: Message: That URL did not map to a valid JSONWP resource

how to fix it?

I use appium in Android 4.3

Cannot install with Python v3.5 due to enum34

Python 3.5 became the default version downloaded from python.org on 9/13 - https://www.python.org/downloads/

Appium-Python-Client currently requires package enum34:

install_requires=['selenium>=2.41.0', 'enum34']

enum34 doesn't seem compatible with Python 3.4+:
https://bitbucket.org/stoneleaf/enum34/issues/5/enum34-incompatible-with-python-35#comment-19462547
opentok/Opentok-Python-SDK#70

This means Appium-Python-Client can't be installed:

Collecting enum34 (from Appium-Python-Client==0.17->-r requirements.txt (line 4))
  Downloading enum34-1.0.4.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "/private/var/folders/d6/t61563nd7xjg32ggy0qkqsbh0000gn/T/pip-build-in3maf22/enum34/enum/__init__.py", line 371, in __getattr__
        return cls._member_map_[name]
    KeyError: '_convert'

    During handling of the above exception, another exception occurred:

I'm not sure what the best solution is since the enum34 issue was closed as wontfix. Perhaps only require if on Python < 3.4?

start_activity 'dict' object has no attribute 'has_key' - python 3.4

After fix #75:

File "C:\Python34\lib\site-packages\appium_python_client-0.14-py3.4.egg
appium\webdriver\webdriver.py", line 553, in start_activity
if opts.has_key(key):
AttributeError: 'dict' object has no attribute 'has_key'

dict.has_key() was removed, in should be used:

for key, value in arguments.items():
    if key in opts:
        data[value] = opts[key]
self.execute(Command.START_ACTIVITY, data)
return self

start_activity working properly after that change.

On OSX find_element_by_id causes "Invalid locator strategy: css selector" error

Hi,

Trying to use Appium-Python-Client on OSX, similar setup works fine on Ubuntu.
Latest versions of Appium, Appium-Python-Client and Selenium.

Calls to find_element_by_id cause an "Invalid locator strategy: css selector".
I can call 'driver.find_elements_by_xpath("//[not()]")' to get all elements present with success, but in this case I would have to query based on element index.

Any advice would be welcome.

Unit tests are broken

    def tearDown(self):
        self.driver.quit()

        # remove zipped file from `test_pull_folder`
        if os.path.isfile(self.zipfilename):
            os.remove(self.zipfilename)

zipfilename is only added in test_pull_file, so teardown generates an error for all other unit tests. The simple fix is

    def tearDown(self):
        self.driver.quit()

        # remove zipped file from `test_pull_folder`
        if hasattr(self, 'zipfilename') and os.path.isfile(self.zipfilename):
            os.remove(self.zipfilename)

I guess it's also worth asking if there's anything we can do to improve our process to ensure unit tests pass before we merge.

Can't find android native element via xpath in selendroid mode

Using latest appium 1.0 with appium python client, I can't find native element in selendroid mode via xpath, but ok for using class name locator strategy:
textfield=self.driver.find_element_by_xpath("//android.widget.EditText")-------Fail.
textfield=self.driver.find_element_by_class_name("android.widget.EditText")-------Pass.

Error in send_to_background - Appium Android

I get an error when calling send_to_background. When it runs, it runs the game and suspends it correctly but fails to resume it. I'm using a Nexus 7 running Android 4.3
Here's the stack trace:

======================================================================
ERROR: test_webview (test_randomize.SimpleAndroidTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/cjubb/dev/MakieLab/dressup-client/Tests/appium/test_randomize.py", line 19, in test_webview
    self.send_to_background(2)
  File "/Users/cjubb/dev/MakieLab/dressup-client/Tests/appium/tablet_test_base.py", line 26, in send_to_background
    self.driver.background_app(time_in_background)
  File "/Users/cjubb/dev/MakieLab/dressup-client/venv/lib/python2.7/site-packages/appium/webdriver/webdriver.py", line 481, in background_app
    self.execute(Command.BACKGROUND, data)
  File "/Users/cjubb/dev/MakieLab/dressup-client/venv/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 173, in execute
    self.error_handler.check_response(response)
  File "/Users/cjubb/dev/MakieLab/dressup-client/venv/lib/python2.7/site-packages/appium/webdriver/errorhandler.py", line 29, in check_response
    raise wde
WebDriverException: Message: u'An unknown server-side error occurred while processing the command. (Original error: com.makielab.DressUpTest/com.unity3d.player.UnityPlayerNativeActivity never started. Current: com.android.launcher/com.android.launcher2.Launcher)' 

Here's the test code:

self.driver.switch_to.context('WEBVIEW_0')
self.send_to_background(2)
sleep(3)

The name of our bundle is com.makielab.DressUpTest.

Unable to install Appium Python client.

Hi,

I've installed appium and would like to start using it with python scripts - although each time I try to install it via the steps given I am given this error:

"error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-14834.pth'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/Library/Python/2.7/site-packages/

Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable."

Thanks,
Karbon62

add pullFolder

/wd/hub/session/:sessionId?/appium/device/pull_folder
expects {path: String path}

Returns a zip file of the contents of the folder. base63 encoded.

Editable field methods of webelement work not stable on Android

The involved methods include: send_keys(), clear(), set_text()

First, let's talk about: clear() and set_text()
555

I select the input field element with find_element_by_android_uiautomator('text("%s")' %text), find it by text info 'Rtyy'. And then if i use element.clear() or element.set_text('xxxx'), an exception raised, NoSuchElementException. Actually, these two methods did something, they deleted the text 'Rtyy' at least. But after they finished delete action, they tried to find the input field element with the original text 'Rtyy' which was deleted, so they cannot find it, and raise the exception.

And the let's talk about send_keys()
666

Look, it is an empty input field. The 'Type message' is nothing. If i use element.send_keys('hello'), guess what happened. 'Type messagehello' input.

Did anybody else find this issue?

'WebDriver' object has no attribute 'context'

current = driver.context

Traceback (most recent call last):
File "<pyshell#16>", line 1, in
current = driver.context
AttributeError: 'WebDriver' object has no attribute 'context'

You are not checking for Selenium package version and don't mention explicitly which version should be installed. I have selenium (2.41.0) - can this be the reason?

Could not import 'webdriver' from 'appium'

I've installed Appium Python Client from PyPi successfully and I could import appium without any error. But when I run 'from appium import webdriver', I've got the Traceback below:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in
from appium import webdriver
File "D:\Python33\lib\site-packages\appium_python_client-0.4-py3.3.egg\appium\webdriver__init__.py", line 19, in
ImportError: No module named 'webdriver'
Anyone could help me on this?
Thank your very much!

send_keys not accepting float values

I am trying to set value for a slider in iOS environment and appium crashes when I set values in float which is a requirement for sliders.

Here is what I am getting:

seekBar.send_keys(0.5)

keys = (0.5,), file_path = '', typing = [], val = 0.5

def is_local_file(self, *keys):
    file_path = ''
    typing = []
    for val in keys:
        if isinstance(val, Keys):
            typing.append(val)
        elif isinstance(val, int):
            val = val.__str__()
            for i in range(len(val)):
                typing.append(val[i])
        else:
           for i in range(len(val)):
                typing.append(val[i])
              TypeError: object of type 'float' has no len()

TouchAction - would be great if tap or press could support an x,y only (no element) scenario

In trying to dismiss the soft keyboard after a .clear() without resetting the session's keyboard setting (i.e. hide_keyboard is a no go), I thought I'd be clever and use TouchAction like this to tap just outside of the element that had displayed the soft keyboard:

def dismiss_keyboard(element):
    elem_x = element.location['x']
    elem_y = element.location['y']
    # Find average x-value between left edge of app and left edge of element 
    benign_x = (elem_x - 0) / 2                                           

    # Tap between element and edge of app to dismiss soft keyboard          
    action = TouchAction(self.driver)                                       
    action.move_to(                                                         
        benign_x, elem_y).press(                                          
            x=benign_x, y=elem_y).release().perform()   

But, of course, not clever, because both press() and tap() require an element:

Traceback (most recent call last):
  File "/Users/kraymoure/repos/r64/qa/tests/mobile/test_ios_environments.py", line 53, in setUp
    self.clear_search()
  File "/Users/kraymoure/repos/r64/qa/tests/mobile/ios_base.py", line 272, in clear_search
    self.dismiss_soft_keyboard(search_input)
  File "/Users/kraymoure/repos/r64/qa/tests/mobile/ios_base.py", line 295, in dismiss_soft_keyboard
    benign_x, search_y).press(
  File "/Library/Python/2.7/site-packages/appium/webdriver/common/touch_action.py", line 79, in move_to
    self._add_action('moveTo', self._get_opts(el, x, y))
  File "/Library/Python/2.7/site-packages/appium/webdriver/common/touch_action.py", line 118, in _get_opts
    opts['element'] = element.id
AttributeError: 'int' object has no attribute 'id'

Click action reports success then app crashes without appium error

ENV: iOS 8.3 real device, MAC, Appium 1.3.7, appium-python-client 0.14.

A once selectable button in my app's UI, is now, not selectable via .click()/.tap() methods. Additionally, if I instantiate a ruby console appium session, I am able to use the appium inspector tool to successfully select the element.

I'm not confident that this is an appium related issue, but I have exhausted all my debugging resources and have come here. Appium reports that the element was successfully clicked according to the appium logs, then immediately there after the app crashes. I am unable to reproduce the button error with manual testing.

I've attached appium and ios logs below:

Thanks for any assistance.

The appium logs are:
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: "au.getElementByName('Settings')"
info: [debug] Sending command to instruments: au.getElementByName('Settings')
info: [debug] [INST] 2015-04-28 17:06:42 +0000 Debug: Got new command 39 from instruments: au.getElementByName('Settings')
info: [debug] [INST] 2015-04-28 17:06:42 +0000 Debug: evaluating au.getElementByName('Settings')
info: [debug] [INST] 2015-04-28 17:06:42 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-04-28 17:06:42 +0000 Debug: responding with:
info: [debug] [INST] 2015-04-28 17:06:42 +0000 Debug: Running system command #40: /usr/local/Cellar/node/0.12.0/bin/node /Users/craig/git/appium/submodules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":""}...
info: [debug] Socket data received (25 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":""}
info: [debug] Condition unmet after 734ms. Timing out.
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":""},"sessionId":"4c331478-3f8d-444a-b22f-52dcce9ed622"}
info: <-- POST /wd/hub/session/4c331478-3f8d-444a-b22f-52dcce9ed622/element 500 734.772 ms - 179
info: --> POST /wd/hub/session/4c331478-3f8d-444a-b22f-52dcce9ed622/element {"using":"name","sessionId":"4c331478-3f8d-444a-b22f-52dcce9ed622","value":"now_playing.search_btn"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: "au.getElementByName('now_playing.search_btn')"
info: [debug] Sending command to instruments: au.getElementByName('now_playing.search_btn')
info: [debug] [INST] 2015-04-28 17:07:24 +0000 Debug: Got new command 40 from instruments: au.getElementByName('now_playing.search_btn')
info: [debug] [INST] 2015-04-28 17:07:24 +0000 Debug: evaluating au.getElementByName('now_playing.search_btn')
info: [debug] [INST] 2015-04-28 17:07:25 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-04-28 17:07:25 +0000 Debug: Lookup returned [object UIAButton] with the name "now_playing.search_btn" (id: 7).
info: [debug] [INST] 2015-04-28 17:07:25 +0000 Debug: responding with:
info: [debug] [INST] 2015-04-28 17:07:25 +0000 Debug: Running system command #41: /usr/local/Cellar/node/0.12.0/bin/node /Users/craig/git/appium/submodules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":{"ELEMENT":"7"}}...
info: [debug] Socket data received (38 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":{"ELEMENT":"7"}}
info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"7"},"sessionId":"4c331478-3f8d-444a-b22f-52dcce9ed622"}
info: <-- POST /wd/hub/session/4c331478-3f8d-444a-b22f-52dcce9ed622/element 200 661.038 ms - 87 {"status":0,"value":{"ELEMENT":"7"},"sessionId":"4c331478-3f8d-444a-b22f-52dcce9ed622"}
info: --> POST /wd/hub/session/4c331478-3f8d-444a-b22f-52dcce9ed622/element/7/click {"sessionId":"4c331478-3f8d-444a-b22f-52dcce9ed622","id":"7"}
info: [debug] Pushing command to appium work queue: "au.tapById('7')"
info: [debug] Sending command to instruments: au.tapById('7')
info: [debug] [INST] 2015-04-28 17:07:26 +0000 Debug: Got new command 41 from instruments: au.tapById('7')
info: [debug] [INST] 2015-04-28 17:07:26 +0000 Debug: evaluating au.tapById('7')
info: [debug] [INST] 2015-04-28 17:07:26 +0000 Debug: UIAButton.tap()
info: [debug] Socket data received (25 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":""}
info: [debug] Responding to client with success: {"status":0,"value":"","sessionId":"4c331478-3f8d-444a-b22f-52dcce9ed622"}
info: <-- POST /wd/hub/session/4c331478-3f8d-444a-b22f-52dcce9ed622/element/7/click 200 1246.794 ms - 74 {"status":0,"value":"","sessionId":"4c331478-3f8d-444a-b22f-52dcce9ed622"}
info: --> POST /wd/hub/session/4c331478-3f8d-444a-b22f-52dcce9ed622/element {"using":"xpath","sessionId":"4c331478-3f8d-444a-b22f-52dcce9ed622","value":"//UIATextField[@value = 'search']"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: "au.mainApp().getTreeForXML()"
info: [debug] Sending command to instruments: au.mainApp().getTreeForXML()
info: [debug] [INST] 2015-04-28 17:07:26 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-04-28 17:07:26 +0000 Debug: responding with:
info: [debug] [INST] 2015-04-28 17:07:26 +0000 Debug: Running system command #42: /usr/local/Cellar/node/0.12.0/bin/node /Users/craig/git/appium/submodules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":""}...
info: [debug] [INST] 2015-04-28 17:07:26 +0000 Fail: The target application appears to have died
info: [debug] [INST STDERR] 2015-04-28 10:07:26.640 instruments[31436:1517626] Attempting to set event horizon when core is not engaged, request ignored
info: [debug] [INST STDERR] 2015-04-28 10:07:26.640 instruments[31436:1517626] Attempting to set event horizon when core is not engaged, request ignored
info: [debug] [INST] Instruments Trace Complete (Duration : 115.550438s; Output : /tmp/appium-instruments/instrumentscli0.trace)
info: [debug] [INSTSERVER] Instruments exited with code 0
info: [debug] Cleaning up after instruments exit
info: [debug] Instruments exited unexpectedly
info: [debug] Shutting down command proxy and ignoring any errors
info: [debug] Closing socket server.
info: [debug] Instruments socket server was closed
info: [debug] Stopping iOS log capture
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killall iOS Simulator
info: [debug] Killing any other simulator daemons
info: [debug] On a real device; cannot clean device state
info: [debug] We were in the middle of processing a command when instruments died; responding with a generic error
info: [debug] Cleaning up appium session
error: Error getting source, can't continue finding element by XPath
info: [debug] Condition unmet after 751ms. Timing out.
info: [debug] Responding to client with error: {"status":13,"value":{"message":"Instruments died while responding to command, please check appium logs","name":"UnknownError","origValue":"Instruments died while responding to command, please check appium logs"},"sessionId":null}
info: <-- POST /wd/hub/session/4c331478-3f8d-444a-b22f-52dcce9ed622/element 500 752.216 ms - 230
info: --> POST /wd/hub/session/4c331478-3f8d-444a-b22f-52dcce9ed622/element {"using":"xpath","sessionId":"4c331478-3f8d-444a-b22f-52dcce9ed622","value":"//*[(@name = 'now_playing.play') or (@name = 'now_playing.pause')]"}
info: <-- POST /wd/hub/session/4c331478-3f8d-444a-b22f-52dcce9ed622/element 404 0.691 ms - 40

iOS Logs:

Apr 28 10:07:26 Craig-Baumgartens-iPhone MobileGestaltHelper[81] : libMobileGestalt MobileGestalt.c:273: server_access_check denied access to question UniqueDeviceID for pid 3432
Apr 28 10:07:26 Craig-Baumgartens-iPhone ScriptAgent[3432] : libMobileGestalt MobileGestaltSupport.m:170: pid 3432 (ScriptAgent) does not have sandbox access for re6Zb+zwFKJNlkQTUeT+/w and IS NOT appropriately entitled
Apr 28 10:07:26 Craig-Baumgartens-iPhone ScriptAgent[3432] : libMobileGestalt MobileGestalt.c:534: no access to UniqueDeviceID (see rdar://problem/11744455)
Apr 28 10:07:26 Craig-Baumgartens-iPhone ReportCrash[3434] : task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument)
Apr 28 10:07:26 Craig-Baumgartens-iPhone ReportCrash[3434] : ReportCrash acting against PID 3431
Apr 28 10:07:26 Craig-Baumgartens-iPhone ReportCrash[3434] : Formulating crash report for process Aether Cone[3431]
Apr 28 10:07:26 Craig-Baumgartens-iPhone locationd[57] : Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
Apr 28 10:07:26 Craig-Baumgartens-iPhone locationd[57] : Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
Apr 28 10:07:26 Craig-Baumgartens-iPhone locationd[57] : Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
Apr 28 10:07:26 Craig-Baumgartens-iPhone locationd[57] : Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
Apr 28 10:07:26 Craig-Baumgartens-iPhone com.apple.xpc.launchd1 : Service exited due to signal: Segmentation fault: 11
Apr 28 10:07:26 Craig-Baumgartens-iPhone SpringBoard[50] : Unable to get short BSD proc info for 3431: No such process
Apr 28 10:07:26 Craig-Baumgartens-iPhone ReportCrash[3434] : Saved report to /var/mobile/Library/Logs/CrashReporter/Aether Cone_2015-04-28-100726_Craig-Baumgartens-iPhone.ips
Apr 28 10:07:26 Craig-Baumgartens-iPhone SpringBoard[50] : Application 'UIKitApplication:com.aether.cone[0x8f61]' crashed.
Apr 28 10:07:26 Craig-Baumgartens-iPhone assertiond[60] : pid_suspend failed for <BKNewProcess: 0x100150450; com.aether.cone; pid: 3431; hostpid: -1>: Unknown error: -1, Unknown error: -1
Apr 28 10:07:26 Craig-Baumgartens-iPhone assertiond[60] : Could not set priority of <BKNewProcess: 0x100150450; com.aether.cone; pid: 3431; hostpid: -1> to 2, priority: No such process
Apr 28 10:07:26 Craig-Baumgartens-iPhone assertiond[60] : Could not set priority of <BKNewProcess: 0x100150450; com.aether.cone; pid: 3431; hostpid: -1> to 4096, priority: No such process
Apr 28 10:07:26 Craig-Baumgartens-iPhone UserEventAgent[17] : id=com.aether.cone pid=3431, state=0
Apr 28 10:07:27 Craig-Baumgartens-iPhone DTMobileIS[194] : Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn
Apr 28 10:07:27 Craig-Baumgartens-iPhone DTMobileIS[194] : Could not create service named com.apple.instruments.server.services.launchdaemon
Apr 28 10:07:27 Craig-Baumgartens-iPhone notification_proxy[133] : 0x100584000 -[MNPLockdownConnection receiveMessage]: lockdown_receive_message error!
Apr 28 10:07:27 Craig-Baumgartens-iPhone notification_proxy[133] : 0x10060c000 -[MNPLockdownConnection receiveMessage]: lockdown_receive_message error!
Apr 28 10:07:27 Craig-Baumgartens-iPhone locationd[57] : Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
Apr 28 10:07:40 Craig-Baumgartens-iPhone kernel[0] : 1119287.328542 wlan0.A[70186] AppleBCMWLANConfigManager::configureRoamingProfile(): Received new roaming profile 3 (was 3, flag=0x0)

start_activity AttributeError

File "C:\Python34\lib\site-packages\appium\webdriver\webdriver.py", line 552, in start_activity
for key in arguments.iterkeys():
AttributeError: 'dict' object has no attribute 'iterkeys'

Should be items() ?

app_strings missing stringFile parameters

Since version 1.3.7, appium server could take "stringFile" parameters to extract the content of a custom localized string file. Otherwise, it will point to the default string file (e.g. ios localizable.strings)
appium/appium#3957

But looks like appium python client - app_strings function has not updated with this feature yet.
Is there a way that we can update this feature soon?
something like: app_strings(language='en', string_file='')

Enable device orientation change (landscape / portrait)

Here is a corresponding method from java-client:

@Override
public void rotate(ScreenOrientation orientation) {
    execute(DriverCommand.SET_SCREEN_ORIENTATION, ImmutableMap.of(
            "orientation", orientation.value().toUpperCase()));
}

The duration argument of WebDriver.tap is inconsistent between code and doc.

I found the doc and code inconsistent in WebDriver.tap method.

The doc of WebDriver.tap says argument duration is in milliseconds:

- duration - (optional) length of time to tap, in ms

But the code deal with duration as it's in seconds:

if duration:
    duration *= 1000  # we take seconds, but send milliseconds
    action.long_press(x=x, y=y, duration=duration).release()

Am I misunderstand anything?

Add Android input method methods (Appium 1.2)

Add methods to query and set the input method (IME) in Android (spec). Five methods are there:

  1. available engines: returns a list of engines available on the device
    • GET /wd/hub/session/:sessionId?/ime/available_engines
    • wd
  2. active engine: returns the currently active engine
    • GET /wd/hub/session/:sessionId?/ime/active_engine
    • wd
  3. is active: returns boolean, IME is active or not (on Android this is always true)
    • GET /wd/hub/session/:sessionId?/ime/activated
    • wd
  4. activate engine: takes the package and activity, and activates it
    • POST /wd/hub/session/:sessionId?/ime/activate
    • payload: { 'engine': 'com.android.inputmethod.latin/.LatinIME` }
    • wd
  5. deactivate engine: deactivates the currently active IME on the device
    • POST /wd/hub/session/:sessionId?/ime/deactivate
    • wd

Tapping with coordinates is tapping twice

I've been trying to execute a single point tap, with both driver.tap and TouchActions with an offset, and it's doing two taps actions. The timing between the two taps vary. Sometimes it's super fast, other times it's a little slower.

I'm using identical code that's used in the readme with a test I'm writing for an Android app:

action.tap(el, 100, 100).perform()
driver.tap(100, 100)

Has anyone else experienced this?

Is there a way to get iOS Log?

Our team use Appium to develop the iOS automation.Now we want to get iOS logs after running App by Appium. Howerer, we don't find a way to get iOS logs which is appeared in Xcode console when debuging project. Android has 'adb logcat', is there is a way like 'adb logcat' in Appium?

How to handle scrollView in ios 7 app.

Hi All,

I have an ios app with welcome sliders when you first launch. It contains 5 UIAImages in UIAscrollView.

I want to swipe it one by one, I see solution in appium doc like:

"An unfortunate bug exists in the iOS 7.x Simulator where ScrollViews don’t recognize gestures initiated by UIAutomation (which Appium uses under the hood for iOS). To work around this, we have provided access to a different function, scroll, which in many cases allows you to do what you wanted to do with a ScrollView, namely, scroll it!".

I used python-client libarary API---Scroll to handle this, but it doesn't work. Element can't scroll by offset. I see java sample code in appium document, can anyone help this and give python sample code.

Thanks

'PATH' not defined

Hi,

I am very much new in this. I apologise in advance if my question is lame.

I am trying to execute "desired_caps['app'] = PATH('Documents/fnbconnect-bernice-112-B43.tar.gz')" in python but I am getting 'PATH' not defined. What am I missing here? Please help..

import unittest
from appium import webdriver
desired_caps = {}
desired_caps['platformName'] = 'iOS'
desired_caps['platformVersion'] = '8.3'
desired_caps['deviceName'] = 'iPhone Simulator'
desired_caps['app'] = PATH('Documents/fnbconnect-bernice-112-B43.tar.gz')
Traceback (most recent call last):
File "", line 1, in
NameError: name 'PATH' is not defined

Adb shell command

Is there any way that I can execute command like this via driver object??

adb shell dumpsys telephony.registry

How to delete IOS app from real device

I am trying to delete ios app from real device but no luck.
Can we do that on a real Ipad. Please suggest

I tried "/usr/local/bin/ideviceinstaller","-u",deviceUDID, "-U", appBundleID but it is not working locally too

Add network connection methods

Two methods needed, one to get the network connection, the other to set it.

The network connection is specified as a bitmask, the details of which are here. Feel free to make whatever structure would be idiomatic for the values.

Getting the connection (e.g., wd):
GET, /wd/hub/session/:sessionId?/network_connection

Setting the connection (e.g., wd):
POST, /wd/hub/session/:sessionId?/network_connection
with payload like "parameters": { "type": 1 }

Add location_in_view accessor to element

Start with Appium 1.2.x the location_in_view on an element was supported.
We need location_in_view so that people can move away from just using the older 'location' accessor because that will eventually be deprecated.

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.