from appium import webdriver
import pytest
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.common.by import By
class TestContact:
def setup(self):
caps = {
"platformName": "Android",
"deviceName": "emulator-5444",
"appPackage": "com.tencent.wework",
"appActivity": ".launch.LaunchSplashActivity bnds",
"autoGrantPermission": "ture",
"noRest":"true",
"dontStopAppOnRest":"true"
}
self.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", caps)
def teardown(self):
pass
def test_contact01(self):
self.driver.implicitly_wait(200)
el1 = self.driver.find_element_by_xpath("//*[@text='拒绝']")
el1.click()
el2 = self.driver.find_element_by_id("com.android.packageinstaller:id/permission_deny_button")
el2.click()
el3 = self.driver.find_element_by_id("com.tencent.wework:id/zw")
el3.click()
el4 = self.driver.find_element_by_id("com.tencent.wework:id/bz9")
el4.click()
el5 = self.driver.find_element_by_id("com.android.packageinstaller:id/permission_deny_button")
el5.click()
el6 = self.driver.find_element_by_xpath("//*[@text='拒绝']")
el6.click()
el7 = self.driver.find_element_by_xpath("//*[@text='拒绝']")
el7.click()
el8 = self.driver.find_element_by_xpath("//*[@text='拒绝']")
el8.click()
if name == ‘main’:
pytest.main()
test_09.py::TestContact::test_contact01 FAILED [100%]
test_09.py:21 (TestContact.test_contact01)
self = <test_09.TestContact object at 0x0000024B51C47970>
def test_contact01(self):
self.driver.implicitly_wait(200)
el1 = self.driver.find_element_by_xpath("//*[@text='拒绝']")
el1.click()
el2 = self.driver.find_element_by_id("com.android.packageinstaller:id/permission_deny_button")
el2.click()
el3 = self.driver.find_element_by_id("com.tencent.wework:id/zw")
el3.click()
el4 = self.driver.find_element_by_id("com.tencent.wework:id/bz9")
el4.click()
el5 = self.driver.find_element_by_id("com.android.packageinstaller:id/permission_deny_button")
el5.click()
el6 = self.driver.find_element_by_xpath("//*[@text='拒绝']")
el6.click()
el7 = self.driver.find_element_by_xpath("//*[@text='拒绝']")
el7.click()