【Appium作业】Appium 企业微信实战1 - 环境搭建与脚本录制

作业地址

作业地址

作业地址

https://github.com/Ashley-luo66/hogwarts_lagou_homework/tree/master/appium_homework/appium_1

import pytest
from appium import webdriver
from appium.webdriver.common.mobileby import MobileBy
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait


class Test_Appium:

    def setup(self):
        desired_caps = {}
        desired_caps['platformName'] = 'android'
        desired_caps['deviceName'] = 'emulator-5554'
        desired_caps['appPackage'] = 'com.tencent.wework'
        desired_caps['appActivity'] = 'com.tencent.wework.launch.WwMainActivity'
        desired_caps['noReset'] = 'true'
        desired_caps['autoGrantPermissions']='true'
        desired_caps['skipDeviceInitialization']='true'
        self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
        self.driver.implicitly_wait(5)

    def teardown(self):
        self.driver.quit()

    @pytest.mark.parametrize('name,mes',[('a1','mes1')])
    def test_1(self,name,mes):
        self.driver.find_element(MobileBy.XPATH, "//*[@resource-id='com.tencent.wework:id/dnj' and @text='通讯录']").click()
        self.driver.find_element(MobileBy.XPATH, "//*[@resource-id='com.tencent.wework:id/gq_']").click()
        self.driver.find_element(MobileBy.XPATH, "//*[@resource-id='com.tencent.wework:id/ffq']").send_keys(name)
        WebDriverWait(self.driver,5).until(expected_conditions.element_to_be_clickable((MobileBy.XPATH,"//*[@resource-id='com.tencent.wework:id/de1']")))
        self.driver.find_element(MobileBy.XPATH,"//*[@resource-id='com.tencent.wework:id/de1']").click()
        self.driver.find_element(MobileBy.XPATH, "//*[@resource-id='com.tencent.wework:id/aam']").click()
        self.driver.find_element(MobileBy.XPATH, "//*[@resource-id='com.tencent.wework:id/dtv']").click()
        self.driver.find_element(MobileBy.XPATH, "//*[@resource-id='com.tencent.wework:id/dtv']").send_keys(mes)
        self.driver.find_element(MobileBy.XPATH, "//*[@resource-id='com.tencent.wework:id/dtr']").click()

https://github.com/GongBin-0923/selenium/blob/master/test_appium/testcase/test_appium_zuoye1.py

作业地址:
https://github.com/hehe1523233/selenium/blob/master/appnium.py