1 from appiumframework.PO import base_page
2 import time
3
4 class CreatPage(base_page.Action):
5 add_button_loc = ("com.smartisan.notes:id/add_button")
6 edittext_loc = ("com.smartisan.notes:id/list_rtf_view")
7 finish_button_loc = ("com.smartisan.notes:id/send_finish_button")
8
9 def add_button_link(self):
10 self.find_element(self.add_button_loc).click()
11 time.sleep(3) #等待3秒,等待登录弹窗加载完成
12
13 def run_case(self,value):
14 self.find_element(self.edittext_loc).send_keys(value)
15 time.sleep(5)
16 self.find_element(self.finish_button_loc).click()
17 time.sleep(2)
18
19 def get_finish_button_text(self):
20 return self.find_element(self.edittext_loc).text
1 class Action(object):
2 #初始化
3 def __init__(self,se_driver):
4 self.driver = se_driver
5
6 #重写元素定位的方法
7 def find_element(self,loc):
8 try:
9 return self.driver.find_element_by_id(loc)
10 except Exception as e:
11 print("未找到%s"%(self,loc))