Related APIs in App automation testing

Source: Internet
Author: User

This API, which is often used in Python automation testing, is as follows:

1, find_element_by_id/find_elements_by_id

Locate the element API using the following method:

driver.find_element_by_id (' digit8')

2, Find_element_by_name

Locate the element API using the following method:

Driver.find_element_by_name ('8')

3, find_element_by_accessibility_id

Locate the element API using the following method:

driver.find_element_by_accessibility_id (' square number ')

4, Press_keycode

The hardware encoded values send the corresponding values, hard-coded corresponding values are as follows:

For example, you need to enter 5, you can send a key value as follows:

Driver.press_keycode (12)

5, Send_keys

Send characters to the corresponding elements, such as:

driver.find_element_by__id (' kw '). Send_keys (' Hello ')

6. Click

When you navigate to an element, click the element and use the following:

driver.find_element_by_accessibility_id (' square number '). Click ()

7, scroll

Scrolls from one element to another:

Ele1 = driver.find_element_by_id (' 1 ')
Ele2 = driver.find_element_by_id (' 10 ')
Driver.scroll (Ele1,ele2)

8, Drag_and_drop

Drag-and-drop operation to drag and drop an element onto another element

Ele1 = driver.find_element_by_id (' 1 ')
Ele2 = driver.find_element_by_id (' 10 ')
Driver.drag_and_drop (Ele1,ele2)

9. Tap

Click action

#单点触摸
Driver.tap ([(x1,y1)])
#多点触摸
Driver.tap ([(X1,y1), (x2,y2)])

10, swipe

Swipe from one position to another:

Driver.swipe (X1,y1,x2,y2)

11, Flick

Fast sliding, similar to swipe

Driver.flick (X1,y1,x2,y2)

12, Current_activity

Show activity for the current app

Print (driver.current_activity)

13, Wait_activity

Wait for activity to display, wait 3s, every 1scheck

Driver.wait_activity (driver.current_activity,3,1)

14, Background_app

Move the app to the background and return to the front desk after a few seconds

Driver.background_app (5)

15, Is_app_install

See if the app is installed

16, Install_app

Install the App

17, Remove_app

Uninstall app

18, Launch_app

Launch app

Related APIs in App automation testing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.