AppUi自動化框架thread_page.py代碼
阿新 • • 發佈:2018-10-07
tor ogg __init__ res class btn pass eset new
from lib.appController import driver_queue
import threading
from lib.pyapp import Pyapp
from lib.logger import logger
class BasePage(object):
def __init__(self, driver=None):
try:
self.driver = driver_queue.get()
self.pyapp = Pyapp(self.driver)
except Exception as e:
logger.error(‘獲取Driver出錯:%s‘ % e)
def reset_app(self):
self.pyapp.reset()
def quit(self):
self.pyapp.quit()
# class ThreadPage(BasePage):
# def content_web_view(self):
# self.pyapp.switch_web_view()
#
# def url(self):
# self.pyapp.type(‘id=>url‘, ‘http://ui.imdsx.cn/uitester/‘)
#
# def enter(self):
# self.pyapp.key_code(66)
#
# def i1(self):
# self.pyapp.type(‘css=>#i1‘, ‘1111111‘)
class QQLogin(BasePage):
def padf(self):
self.pyapp.click(‘id=>com.tencent.mobileqq:id/btn_login‘)
def username(self):
css=‘content=>請輸入QQ號碼或手機或郵箱‘
self.pyapp.type(css,1061982257)
def passwd(self):
css = ‘content=>密碼 安全‘
self.pyapp.type(css,‘Yjbtest123‘)
def login(self):
css=‘android=>new UiSelector().text("登 錄")‘
self.pyapp.click(css)
# class Page(ThreadPage):
class Page(QQLogin):
pass
AppUi自動化框架thread_page.py代碼