ppium use instructions

Driver, Ltd. Free Join
# element positioning
driver.find_element_by_id ( "id") # id positioning
driver.find_element_by_name ( "name") # name positioning
driver.find_element_by_link_text ( "text") # link names positioning
driver.find_element_by_partial_link_text ( "text") # by elements part of the visible link text positioning
driver.find_element_by_tag_name ( "name") # name positioned elements by searching for the tags of html
driver.find_element_by_xpath ( "xpath") # path to locate
driver.find_element_by_class_name ( "android.widget.LinearLayout") # class name positioning
driver .find_element_by_css_selector ( "css") # css selector positioned

# plurality of positioning elements set
driver.find_elements_by_id ( "id") # id element in the set
driver.find_elements_by_name ( "name") # name element set
driver.find_elements_by_link_text ( "text") # Link name elements of the collection
driver.find_elements_by_partial_link_text ( "text") # some elements visible link collection
driver.find_elements_by_tag_name ( "name") # html tag name set
driver.find_elements_by_xpath ( "xpath") # positioning path set
driver.find_elements_by_class_name ( "android.widget.LinearLayout") # Class Name Location set
driver.find_elements_by_css_selector ( "css") select # CSS positioned set

# input box
driver.element.send_keys ( "Britain")

# lock screen
driver.lock (. 5)

# the current application in the background
driver.background_app (. 5)

# stowed keyboard
driver.hide_keyboard ()

# Activity or open an application, only Andrews end
driver.start_activity ( 'com.example.android.apis', '.foo')

# open the drop-down notification bar Android only
driver.open_notifications ()

# drag element, the element origin_el onto the target element destination_el
driver.drag_and_drop (Self, origin_el, destination_el):

# Check whether the installed app
driver.is_app_installed ( 'com.example.android.apis')

# is mounted to the appliance
driver.install_app ( 'path / to / my.apk')

# remove application
driver.remove_app ( 'com.example.android.apis')

# analog devices shake
driver.shake ()


# close the application
driver.close_app ()

# start (launch)
# service according to the keyword (desired capabilities) to start the session (session). Note that this must take effect when setting autoLaunch = false keywords.
# This is not the start the specified app / activities ---- you can use to achieve this effect start_activity ----
# This is used to continue using autoLaunch = initialization of false keyword (Launch) process.
driver.launch_app ()

# reset the application, which is equivalent to re-uninstall
driver.reset ()

# available context (context) lists all the available context
# translate NOTE: context can be understood as a window accessible. For example, for native application, available context and the default context are NATIVE_APP.
# For details, see the automated testing of hybrid applications
driver.contexts

# List current context
driver.current_context

# switch to the default context (context)
# switch context to the default context
driver.switch_to.context (None)

# string acquisition application
driver.app_strings

# key event (Key Event) to the device sending a key event
driver.keyevent (176)

# Get the current Activity
driver.current_activity

# touch operation (TouchAction) / multi-touch operation (MultiTouchAction)
action = TouchAction (Driver)
action.press (EL Element =, X = 10, . y = 10) .release () perform ()

sliding # slide (the Swipe) analog subscriber
# Note: appium slide rule is x increases from left to right, y increases from top to bottom
driver.swipe (start = 75, = 500 startY, EndX = 75, Endy = 0, DURATION = 800)

# kneader (Pinch) kneaded screen (two fingers to move to narrow the screen)
driver.pinch (= EL Element)

# amplification (zoom) to enlarge the screen (bis refers to move outwardly to enlarge the screen)
driver.zoom (= EL Element)

# Slid onto an element (the To the Scroll)
TODO: Python

# pull the document (Pull File) from the device
driver.pull_file ( 'Library / the AddressBook / AddressBook.sqlitedb')

# push into the device file
data = "some data The File for "
path =" /data/local/tmp/file.txt "
driver.push_file (path, data.encode ( 'Base64'))

# asserted
Assert.assertEquals (" I am a div " , div.getText ( )); // jump to a specific page and the page it interacts with the id of the element

whether # check the text in line with expectations
assertEqual ( 'the I AM A div', div.text)

# input method for activity to return true and false
is_ime_active ( Self):

# returns the currently available input devices Andrews
driver.available_ime_engines (Self):

# input to activate Andrews developing apparatus
driver.activate_ime_engine (Self, Engine):

# Close the current input method (Android)
driver.deactivate_ime_engine ( self):

# Open position location device disposed on Android
driver.toggle_location_services ()

# set the device's latitude and longitude
: Args:
- Latitude Latitude - String or numeric value and the BETWEEN -90.0 90.00
- longitude longitude - String or numeric value and the BETWEEN -180.0 180.0
- Altitude's altitude - String or numeric value
Usage driver .set_location (latitude, longitude, altitude)

# click
element.click ()

# remove an element content
element.clear ()

# returns the element's text content
element.text ()

# submit the form
element.submit (Self):

# element is available
element.is_enabled ()

# optional whether the element
element.is_slected ()

# element is visible
element.is_displayed (http://www.my516.com)

# obtain the element's size (height and width)
new_size [ "height"] = size [ "height"]
new_size [ "width"] = size [ "width"]
driver.element.size

# coordinate of the upper left corner of the acquired element
# usage driver.element.location
'' 'return element x coordinate, int type' ''
driver.element.location.get ( 'x')
'' 'return element y-coordinate, int type '' '
driver.element.location.get (' y ')

# Get the current element screenshot Base64 encoded string
img_b64 = element.screenshot_as_base64

# execute the JS
# in the current window / frame (especially Html the iframe) synchronization executing javascript code
driver.execute_script ( 'document.title')
# asynchronously execute code in other code execution
driver.execute_async_script ( 'document.title')

# Get the current URL
driver.current_url

# acquired page source
driver. page_source

# close the current window
driver.close ()


# close the application
driver.() quit

testing # on Chrome
{
'PlatformName': 'the Android',
'platformVersion': '4.4',
'deviceName': 'Android Emulator',
'browserName': 'Chrome'
}

# 真机测试
{
'automationName': 'Selendroid',
'platformName': 'Android',
'platformVersion': '2.3',
'deviceName': 'Android Emulator',
'app': myApp,
'appPackage': 'com.mycompany.package',
'appActivity': '.MainActivity'
}

# 多点触控
"""* execute (perform)* cancel (the Cancel)* Press (longPress)* waiting (the wait)* Click (TAP)* move to (moveTo)* release (Release)* Short press (Press)
Specification available events are:







Guess you like

Origin www.cnblogs.com/ly570/p/11291183.html