android UI using the positioning tool -uiautomator2

Introduction:

uiautomator2 is a Python can be used on Android devices UI Automation library. Its underlying database can be obtained based on uiautomator Google uiautomator, Google provided on the screen of any of any of APP control property, and any of its operations, but there are two drawbacks:

1, test scripts can only use the Java language.

2, the test scripts must be uploaded to run on every device. We hope to be able to test more with a scripting language, such as writing Python, and can be modified each time WYSIWYG test, run test.

installation:

pip install --pre uiautomator2
pip install pillow

initialization:

Deployment-related daemon.

Phone or a computer connected to the plurality of mobile phones, has been added to ensure adb environment variable, the following command will automatically install the library apparatus side program required: uiautomator-server, atx-agent, openstf / minicap, openstf / minitouch

python -m uiautomator2 init

Installation is complete, more than one application uiautomator on the device.

weditor installation:

We can help uiautomatorviewer Android SDK from the view element, which requires the phone to be connected to the PC's USB mode, used in front of me is a WIFI connection for connection. So, openatx weditor provides another tool to solve this problem.

weditor is a tool that allows uiautomator Android UI interface display.

pip install --pre --upgrade weditor

use:

python -m weditor

After executing the command, the default browser opens the page

 

 

Select Android, input device IP (192.168.31.234) in the upper left corner of the page, click the Connect button.

When we finished operating the phone, you can click on the "Reload" button to refresh, to keep the interface on the device to keep pace. weditor can also help us generate code.

*** wireless links can also, at the same WiFi, cell phone link IP address.

 

GitHub Address: https://github.com/openatx/uiautomator2

GitHub Address: https://github.com/openatx/weditor

 

Guess you like

Origin www.cnblogs.com/moying-wq/p/11569446.html