appium启动真机 - 微信企业报错


#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date    : 2020/11/27 17:17
# @Author  : Zy
# @File    : test_homework1.py
# @Software: PyCharm
'''
删除 微信联系人
'''
from appium import webdriver
from appium.webdriver.common.mobileby import MobileBy

class TestHomeWork:
    def setup(self):
        _appPackage = 'com.tencent.wework'
        _appActivity = ".launch.WwMainActivity"
        self.desire_cap = {
            # 默认是Android
            "platformName": "android",
            # adb devices的sn名称
            "deviceName": "ac52df0f",
            # 包名
            "appPackage": _appPackage,
            # activity名字
            "appActivity": _appActivity,
            "noReset": 'true',
            "unicodeKeyboard": 'true',
            "resetKeyboard": 'true',
            # "skipDeviceInitialization": 'true'
            'autoGrantPermissions': 'true'
        }
        self._driver = webdriver.Remote(
            "http://127.0.0.1:4723/wd/hub", self.desire_cap)
        self._driver.implicitly_wait(10)
    def test_del(self):
        '''
        删除联系人
        :return:
        '''
        # 点击
        self._driver.find_element(MobileBy.ID, 'com.tencent.wework:id/i6n').click()
        # 输入文字
        self._driver.find_element(MobileBy.CLASS_NAME, 'android.widget.EditText').send_keys('曹华')
        # 判断判断检查结果
        eles = self._driver.find_element(MobileBy.XPATH, "//*[contains(@text,'曹华'')]")
        if eles:
            pass
        else:
            print('无相关联系人')


问题解决, 活动页写的不对
原因: 用 logcat | grep -i displayed 命令忽略掉微信启动页