前言
Macbook prom1+android虚拟机+pycharm+pytest+appium 实现微信登录
1. 第三方库
- appium-python-client
- pyyaml
- pytest
- selenium
app.py
from appium import webdriver
from Page.basepage import BasePage
from Page.main import Main
class App(BasePage):
# 启动app
def start(self):
_package = "com.tencent.mm"
_activity = "com.tencent.mm.ui.LauncherUI"
if self._driver is None:
desir_cap = {
"appPackage": "com.tencent.mm",
"appActivity": "com.tencent.mm.ui.LauncherUI",
"platformName": "Android",
"platformVersion": "12",
"dontStopAppOnReset": "true",
"noReset": "true",
"deviceName": "emulator-5554"
}
self._driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desir_cap)
self._driver.implicitly_wait(5) # 隐式等待5s
else:
self._driver.start_activity(_package, _activity)
return self
def