手机自动化测试笔记:1.appium的安装与使用

时间:2024-06-08 18:45:40

建议先安装前置的程序,同时建议使用anconda进行环境管理。

参考1:

深度学习笔记:1.anaconda安装-****博客https://blog.****.net/weixin_42771529/article/details/139434840

参考2:

 笔记:如何在pycharm中使用anaconda的虚拟环境,新建工程和更改现有工程的虚拟环境。-****博客https://blog.****.net/weixin_42771529/article/details/139448503

1. 下载与安装

Releases · appium/appium-desktop (github.com)https://github.com/appium/appium-desktop/releases选择适合自己的

双击安装,

 

 第一次运行,有点慢,稍安。

上一章设计正常的话,这儿自动出现。

可以改成中文。

 启动界面

连接手机,如何连接,知机器不太一样。

华为手机不要装手机助手。影响很大。

黑窗口下输入,查看结果。

C:\Users\Administrator>adb devices
List of devices attached
Q5X7N19605002672        device

如上代表成功。

相关可能出现的问题,参考我以前的努力。最后有问题可能解决的方案。也可以留言,但不保证解决。

笔记:从0开始到测试成功的手机模拟操作,一步步来,你可能会的更快。_appium和appium-inspector-****博客

2. appium-inspector的安装与使用

Releases · appium/appium-inspector · GitHubhttps://github.com/appium/appium-inspector/releases让其showall.查看全部。

我使用的win64的,你根据你的。

双击安装。

 

运行

可以改成中文。

3.环境的配置anaconda,在虚拟环境下安装

pip install Appium-Python-Client
(appenv) C:\Users\Administrator>pip install Appium-Python-Client
Collecting Appium-Python-Client
  Downloading Appium-Python-Client-4.0.0.tar.gz (3.4 MB)
     ---------------------------------------- 3.4/3.4 MB 2.8 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting selenium~=4.12 (from Appium-Python-Client)
  Downloading selenium-4.21.0-py3-none-any.whl.metadata (6.9 kB)
Collecting urllib3<3,>=1.26 (from urllib3[socks]<3,>=1.26->selenium~=4.12->Appium-Python-Client)
  Downloading urllib3-2.2.1-py3-none-any.whl.metadata (6.4 kB)
Collecting trio~=0.17 (from selenium~=4.12->Appium-Python-Client)
  Downloading trio-0.25.1-py3-none-any.whl.metadata (8.7 kB)
Collecting trio-websocket~=0.9 (from selenium~=4.12->Appium-Python-Client)
  Downloading trio_websocket-0.11.1-py3-none-any.whl.metadata (4.7 kB)
Collecting certifi>=2021.10.8 (from selenium~=4.12->Appium-Python-Client)
  Downloading certifi-2024.6.2-py3-none-any.whl.metadata (2.2 kB)
Collecting typing_extensions>=4.9.0 (from selenium~=4.12->Appium-Python-Client)
  Downloading typing_extensions-4.12.1-py3-none-any.whl.metadata (3.0 kB)
Collecting attrs>=23.2.0 (from trio~=0.17->selenium~=4.12->Appium-Python-Client)
  Downloading attrs-23.2.0-py3-none-any.whl.metadata (9.5 kB)
Collecting sortedcontainers (from trio~=0.17->selenium~=4.12->Appium-Python-Client)
  Downloading sortedcontainers-2.4.0-py2.py3-none-any.whl.metadata (10 kB)
Collecting idna (from trio~=0.17->selenium~=4.12->Appium-Python-Client)
  Downloading idna-3.7-py3-none-any.whl.metadata (9.9 kB)
Collecting outcome (from trio~=0.17->selenium~=4.12->Appium-Python-Client)
  Downloading outcome-1.3.0.post0-py2.py3-none-any.whl.metadata (2.6 kB)
Collecting sniffio>=1.3.0 (from trio~=0.17->selenium~=4.12->Appium-Python-Client)
  Downloading sniffio-1.3.1-py3-none-any.whl.metadata (3.9 kB)
Collecting cffi>=1.14 (from trio~=0.17->selenium~=4.12->Appium-Python-Client)
  Downloading cffi-1.16.0-cp312-cp312-win_amd64.whl.metadata (1.5 kB)
Collecting wsproto>=0.14 (from trio-websocket~=0.9->selenium~=4.12->Appium-Python-Client)
  Downloading wsproto-1.2.0-py3-none-any.whl.metadata (5.6 kB)
Collecting pysocks!=1.5.7,<2.0,>=1.5.6 (from urllib3[socks]<3,>=1.26->selenium~=4.12->Appium-Python-Client)
  Downloading PySocks-1.7.1-py3-none-any.whl.metadata (13 kB)
Collecting pycparser (from cffi>=1.14->trio~=0.17->selenium~=4.12->Appium-Python-Client)
  Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes)
Collecting h11<1,>=0.9.0 (from wsproto>=0.14->trio-websocket~=0.9->selenium~=4.12->Appium-Python-Client)
  Downloading h11-0.14.0-py3-none-any.whl.metadata (8.2 kB)
Downloading selenium-4.21.0-py3-none-any.whl (9.5 MB)
   ---------------------------------------- 9.5/9.5 MB 1.6 MB/s eta 0:00:00
Downloading certifi-2024.6.2-py3-none-any.whl (164 kB)
   ---------------------------------------- 164.4/164.4 kB 548.7 kB/s eta 0:00:00
Downloading trio-0.25.1-py3-none-any.whl (467 kB)
   ---------------------------------------- 467.7/467.7 kB 443.7 kB/s eta 0:00:00

4.利用pycharm进行测试

打开 pycharm,新建一个 python 文件,输入 from appium.webdriver.webdriver import WebDriver 不报错说明 pip 安装成功。

 下节课学习,如何查看手机中的一些app的参数。然后启动