Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

(5) use inspector to locate elements and automatically generate test scripts

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Start the simulator

Start appium server

The app to be tested on the configuration

The corresponding simulator device information on the configuration

Use Appium inspector to locate elements, record, generate scripts, etc.

Positioning element

1. Open the APP to be tested on the simulator and open the corresponding page, such as the landing page

two。 Start Appium inspector, as shown in the following figure, and find the input user name box. The corresponding detail information contains its basic information, including xpath.

3. A row of buttons in the lower left corner is the corresponding operation event.

Touch

Tap: click on the selected control

Swipe: smoothing

Shake: shake

Precise Tap: multi-touch

Scroll To: slide to

Text

Send_keys: enter a value-the most commonly used

Locator

Locate and locate an element based on a known selector

4. According to the xpath shown in the above picture, you can get the user name input box of the login interface to locate, or take name,class name and so on.

Record, generating script

Under the premise of locating the element in the previous step, record the operation and generate the script

1. On the above interface, click the Record button to see the code block stretched out below the inspector interface, and you can freely switch scripting languages.

Here you will generate some basic code to create a client and connect to the server

two。 Enter the content in the input box, as shown in the following figure. After entering the content, click the Send_Keys button.

3. The effect after successfully entering the content. Enter successfully on the right. In the code area, record the generated code.

4. In the same way, find the password control, then click Text-Send_Keys to enter the password to generate the code

5. Find the login control, and then Touch-Tap operation to simulate the click event to generate code

6. The code for the login interface is generated.

7. Click Save in the code area and save the generated code as a file.

Attached:

Learn about video sources

Https://www.youtube.com/watch?v=Hv9A9WfYF4g

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report