在CMD中运行 pip install Appium-Python-Client
Microsoft Windows [版本 10.0.19045.3693]
(c) Microsoft Corporation。保留所有权利。
C:\Users\Administrator>pip install Appium-Python-Client
Collecting Appium-Python-Client
Downloading Appium-Python-Client-3.1.0.tar.gz (3.4 MB)
---------------------------------------- 3.4/3.4 MB 297.9 kB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: selenium~=4.12 in c:\users\administrator\appdata\roaming\python\python312\site-packages (from Appium-Python-Client) (4.15.2)
Requirement already satisfied: urllib3<3,>=1.26 in c:\users\administrator\appdata\roaming\python\python312\site-packages (from urllib3[socks]<3,>=1.26->selenium~=4.12->Appium-Python-Client) (2.0.7)
Requirement already satisfied: trio~=0.17 in c:\users\administrator\appdata\roaming\python\python312\site-packages (from selenium~=4.12->Appium-Python-Client) (0.23.1)
Requirement already satisfied: trio-websocket~=0.9 in c:\users\administrator\appdata\roaming\python\python312\site-packages (from selenium~=4.12->Appium-Python-Client) (0.11.1)
Requirement already satisfied: certifi>=2021.10.8 in c:\users\administrator\appdata\roaming\python\python312\site-packages (from selenium~=4.12->Appium-Python-Client) (2023.7.22)
Requirement already satisfied: attrs>=20.1.0 in c:\users\administrator\appdata\roaming\python\python312\site-packages (from trio~=0.17->selenium~=4.12->Appium-Python-Client) (23.1.0)
Requirement already satisfied: sortedcontainers in c:\users\administrator\appdata\roaming\python\python312\site-packages (from trio~=0.17->selenium~=4.12->Appium-Python-Client) (2.4.0)
Requirement already satisfied: idna in c:\users\administrator\appdata\roaming\python\python312\site-packages (from trio~=0.17->selenium~=4.12->Appium-Python-Client) (3.4)
Requirement already satisfied: outcome in c:\users\administrator\appdata\roaming\python\python312\site-packages (from trio~=0.17->selenium~=4.12->Appium-Python-Client) (1.3.0.post0)
Requirement already satisfied: sniffio>=1.3.0 in c:\users\administrator\appdata\roaming\python\python312\site-packages (from trio~=0.17->selenium~=4.12->Appium-Python-Client) (1.3.0)
Requirement already satisfied: cffi>=1.14 in c:\users\administrator\appdata\roaming\python\python312\site-packages (from trio~=0.17->selenium~=4.12->Appium-Python-Client) (1.16.0)
Requirement already satisfied: wsproto>=0.14 in c:\users\administrator\appdata\roaming\python\python312\site-packages (from trio-websocket~=0.9->selenium~=4.12->Appium-Python-Client) (1.2.0)
Requirement already satisfied: pysocks!=1.5.7,<2.0,>=1.5.6 in c:\users\administrator\appdata\roaming\python\python312\site-packages (from urllib3[socks]<3,>=1.26->selenium~=4.12->Appium-Python-Client) (1.7.1)
Requirement already satisfied: pycparser in c:\users\administrator\appdata\roaming\python\python312\site-packages (from cffi>=1.14->trio~=0.17->selenium~=4.12->Appium-Python-Client) (2.21)
Requirement already satisfied: h11<1,>=0.9.0 in c:\users\administrator\appdata\roaming\python\python312\site-packages (from wsproto>=0.14->trio-websocket~=0.9->selenium~=4.12->Appium-Python-Client) (0.14.0)
Building wheels for collected packages: Appium-Python-Client
Building wheel for Appium-Python-Client (pyproject.toml) ... done
Created wheel for Appium-Python-Client: filename=Appium_Python_Client-3.1.0-py3-none-any.whl size=337588 sha256=d29b618102d0b617d4b42076d3b21df506d701b10f3669ae5079861b7261e24a
Stored in directory: c:\users\administrator\appdata\local\pip\cache\wheels\f9\96\78\c77d7a11d58afb91cf95104558a38e4e56745a8590177f71da
Successfully built Appium-Python-Client
Installing collected packages: Appium-Python-Client
Successfully installed Appium-Python-Client-3.1.0
示例代码
'''
@Time : 2018/11/12 13:37
@Author : davieyang
@Software: PyCharm
@Description:
'''
# encoding = utf-8
from appium import webdriver
import time
import unittest
class test_ClickButon(unittest.TestCase):
def setUp(self):
desired_caps = {
'platformName': 'Android',
'deviceName': '30d4e606',
'platformVersion': '5.0',
'appPackage': 'com.tencent.qqpimsecure',
'appActivity': 'com.tencent.server.fore.QuickLoadActivity'
}
self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
def test_ClickButton(self):
driver = self.driver
driver.find_element_by_id("com.tencent.mobileqq:id/btn_login").click()