def step_impl(context): ele = music.get_music_mylove_btn() if ele.wait.exists(): x_coordinate, y_coordinate = uit.get_clickcoord_by_ele(ele) d.click(x_coordinate, y_coordinate) else: uit.raise_Exception_info('最爱音乐按钮不存在')
def step_impl(context): # 获取专辑名称 artist_name = context.table[0]['artist_name'] ele = music.get_artist_from_artist_list_by_artist_name(artist_name) if ele.wait.exists(): x_coordinate, y_coordinate = uit.get_clickcoord_by_ele(ele) d.click(x_coordinate, y_coordinate) else: uit.raise_Exception_info('指定歌手不存在')
def step_impl(context): # 获取音乐名称 music_name = context.table[0]['music_name'] ele = music.get_music_from_collect_list_by_music_name(music_name) if ele.wait.exists(): x_coordinate, y_coordinate = uit.get_clickcoord_by_ele(ele) d.click(x_coordinate, y_coordinate) else: uit.raise_Exception_info('指定音乐不存在')
def step_impl(context): """ 点击拨号键盘 :param context: :return: """ dial_ele = btphone.get_phone_dial_tab_ele() if dial_ele.wait.exists(): pos_x, pos_y = uit.get_clickcoord_by_ele(dial_ele) d.click(pos_x, pos_y) else: uit.raise_Exception_info('拨号键盘控件不存在')
def step_impl(context): """ 点击最近通话 :param context: :return: """ calllog_ele = btphone.get_phone_calllog_tab_ele() if calllog_ele.wait.exists(): pos_x, pos_y = uit.get_clickcoord_by_ele(calllog_ele) d.click(pos_x, pos_y) else: uit.raise_Exception_info('最近通话控件不存在')
def step_impl(context): """ 点击通讯录 :param context: :return: """ contacts_ele = btphone.get_phone_contacts_tab_ele() if contacts_ele.wait.exists(): pos_x, pos_y = uit.get_clickcoord_by_ele(contacts_ele) d.click(pos_x, pos_y) else: uit.raise_Exception_info('通讯录控件不存在')
def step_impl(context): """ 点击通讯录中指定联系人 :param context: :return: """ # 获取联系人名称 name = context.table[0]['contact'] contact_ele = btphone.get_phone_contact_by_name(name) if contact_ele.wait.exists(): pos_x, pos_y = uit.get_clickcoord_by_ele(contact_ele) d.click(pos_x, pos_y) else: uit.raise_Exception_info('指定联系人在通讯录中不存在')
def step_impl(context): """ 点击图片文件, 图片文件带有后缀 :param context: :return: """ # 获取图片文件名参数 photo_name = context.table[0]['photo_name'] photo_ele = photo.get_photo_by_name(photo_name) if photo_ele.wait.exists(): pos_x, pos_y = uit.get_clickcoord_by_ele(photo_ele) d.click(pos_x, pos_y) else: uit.raise_Exception_info('指定图片文件不存在')
def step_impl(context): """ 点击图片文件夹 文件夹名称不包含图片数量 :param context: :return: """ # 获取文件夹名称 folder_name = context.table[0]['folder_name'] folder_ele = photo.get_photo_folder_by_name(folder_name) if folder_ele.wait.exists(): pos_x, pos_y = uit.get_clickcoord_by_ele(folder_ele) d.click(pos_x, pos_y) else: uit.raise_Exception_info('指定文件夹不存在')
def step_impl(context): # 获取应用名称 app_name = context.table[0]['app_name'] print(app_name) if app_name == '收音机': radio_ele = home.get_home_radio_layout() if radio_ele.wait.exists(): radio_ele.click() else: uit.raise_Exception_info('收音机控件没有找到') elif app_name == '音乐': music_ele = home.get_home_music_layout() if music_ele.wait.exists(): pos_x, pos_y = uit.get_clickcoord_by_ele(music_ele) d.click(pos_x, pos_y) else: uit.raise_Exception_info('音乐控件没有找到') else: x_coordinate, y_coordinate = uit.get_clickcoord_from_bounds(text=app_name) d.click(x_coordinate, y_coordinate)