def confirm_btn(self): """确认按钮""" selector = 'view.footer' inner_text = '确认' btn = self.page.get_element(selector).get_element('view.buttons').get_element('view.button').get_element('text', inner_text=inner_text) outer_wxml = btn.outer_wxml helper.ignore_unused(outer_wxml) return btn
def clear_btn(self): """清空按钮""" selector = 'view.footer' inner_text = '清空' btn = self.page.get_element(selector).get_element('view.buttons').get_element('text.clear', inner_text=inner_text) outer_wxml = btn.outer_wxml helper.ignore_unused(outer_wxml) return btn
def calendar_year(self, year): """年""" selector = 'view.calendar.header' inner_text = year el_y = self.page.get_element(selector).get_element( 'view.years').get_element('view.year', inner_text=inner_text) outer_wxml = el_y.outer_wxml helper.ignore_unused(outer_wxml) return el_y
def calendar_month(self, month): """月""" selector = 'view.calendar.header' inner_text = month el_m = self.page.get_element(selector).get_element( 'view.months').get_element('view.scroll-view').get_element( 'span.month', inner_text=inner_text) outer_wxml = el_m.outer_wxml helper.ignore_unused(outer_wxml) return el_m
def finish_btn(self): """完成按钮""" selector = 'view.button' inner_text = '完成' btns = self.page.get_elements(selector) el_btn = None for btn in btns: if btn.get_element('text').inner_text.strip().startswith( '共计') and btn.inner_text.strip().endswith(inner_text): el_btn = btn break outer_wxml = el_btn.outer_wxml helper.ignore_unused(outer_wxml) return el_btn
def selected_area(self, name): """已经选中的地区,返回地区元素的关闭图标对象""" selector = 'view.footer' inner_text = name selected_city_views = self.page.get_element(selector).get_element('scroll-view.selected').get_element('view').get_elements('view.rows') parent = None for scv in selected_city_views: el_city = scv.get_element('text.select', inner_text=inner_text) if el_city and el_city.inner_text == inner_text: # find element parent = scv break del_icon = parent.get_element('mp-icon') outer_wxml = del_icon.outer_wxml helper.ignore_unused(outer_wxml) return del_icon
def total_btn(self): """ 共计 天""" selector = 'view.button' inner_text = '完成' btns = self.page.get_elements(selector) right_el_total = None for btn in btns: el_total = btn.get_element('text') itext = el_total.inner_text.strip() if itext.startswith('共计') and itext.endswith( '天') and btn.inner_text.strip().endswith(inner_text): right_el_total = el_total break outer_wxml = right_el_total.outer_wxml helper.ignore_unused(outer_wxml) return right_el_total
def selected_date_btn(self): """展开已选日期""" selector = 'view.select-date' inner_text = '展开已选日期' el_views = self.page.get_element(selector).get_elements('view') elv = None for el_view in el_views: el_text = el_view.get_element('text', inner_text=inner_text) if el_text: elv = el_view break el_icon = elv.get_element('text') outer_wxml = el_icon.outer_wxml helper.ignore_unused(outer_wxml) return el_icon
def find_curr_duration(self, duration): cd = self.page.elements.curr_duration(duration) helper.ignore_unused(cd) return self
def find_curr_area(self, area_text): ca = self.page.elements.curr_area(area_text) outer_wxml = ca.outer_wxml helper.ignore_unused(outer_wxml) return self