Install Uiaotumator2 under Mac System:
Reference URL: "Uiautomator2" and reference to GitHub official documentation
1. Install the UIAOTUMATOR2 command:
Pip Install--upgrade--pre uiautomator2
Prompt error:
Could not install packages due to a environmenterror: [Errno 1] Operation not permitted: '/usr/local/bin/chardetect '
Pip install--user--upgrade--pre Uiautomator2
The above-mentioned yellow information is recommended to set the environment path for the above several execution programs, and these execute programs are in AppData this hidden path, you need to manually enter the file path field
Refer to "url" above for problem solving
2.
Deploy Associated daemons to a device PC connect to a phone or multiple phones, make sure ADB has been added to the environment variable, execute the following command to automatically install the required device-side program for this library: Uiautomator-server, atx- Agent, Openstf/minicap, Openstf/minitouch
# init All devices that are already connected to the computer
Python-m Uiautomator2 Init
Installation to this block, found a serious problem: The installation failed to check that before the installation, Pip installed Uiautomator2 when installed in the python2.7 default version.
Interestingly, the Python version is 3.6.1, but the PIP defaults to version 2.7, which is crazy.
Later, after the inquiry, the following is the solution :
"Mac OSX installs Python 2.7 and Python3.6 and FAQs"
The reason is that the name of my PATH environment variable is incorrectly written, the following workaround:
#打开. bash_profile file: open-e. bash_profile
My default path path is, red is the problem place:
Export path=${path}:/users/zhangc/.pyenv/versions/3.6.1/bin
Modified to:
Export Path=/users/zhangc/.pyenv/versions/3.6.1/bin: $PATH
Put the path behind, why don't you know.
Save. Bash_profile file: Command+s.
Finally let the path variable take effect on the command:
source. bash_profile
Re-enter the command:
pip--version or pip-v
The display is correct:
Pip 9.0.1 from/users/zhangc/.pyenv/versions/3.6.1/lib/python3.6/site-packages (Python 3.6)
Start from now on to install the UIAUTOMATOR2 environment again , sad!!! >o<
First, install the UIAUTOMATOR2 command
Pip Install--upgrade--pre uiautomator2
Successfully, prompting Uiautomator2 to install successfully, such as:
Second, can selectively install pillow,
processing screen data, do not force
To install the Pillow command:
Pip Install Pillow
Requirement already satisfied: The hint has been installed in the environment.
Iii. installation of ADB
because my Mac has adb so it doesn't have to be installed, the specific installation steps refer to the Mac install ADB and basic commands
But I need the device number information, the command is:
ADB devices output device number information
Iv. installation of the device end program
# init all devices already connected to the computer python-m UIAUTOMATOR2 Init
The output success indicates success, such as:
V. Install weditor (UI Inspector)
Because Uiautomator is an exclusive resource, Uiautomatorviewer is not available when the ATX is running, and in order to reduce the frequent start-stop of the ATX, we have developed a browser-based Weditor UI viewer. Https://github.com/openatx/weditor
To install the command method:
Pip Install--pre-u Weditor
Successfully, prompting for successful installation, such as:
Six, start Weditor
Command line startup:
Python-m Weditor
will automatically open the browser, enter the device's IP or serial number, click Connect.
Specific reference article: Talking about the automatic test tool Python-uiautomator2
To open the browser automatically:
Enter the ADB's device number, click the "Connect" button to connect, and press "Reload" blue button to refresh the phone page, such as
At this point UIAOTUMATOR2 installation success!!!
Installation steps for "Mac installation Uiautomator2"