def operation_who_i_business_framework_click(self): self.action.click(self.click_wholesale_locator) self.action.click(self.click_transport_locator) self.action.click(self.click_warehouse_locator) get_element(self.driver, self.click_Labor_dispatch).click() get_element(self.driver, self.click_confirm_button).click() pass
def web_input_activation_commodity(self, path=None): a = get_elements(self.driver, self.click_activation_locator) a[0].click() get_element(self.driver, self.import_commodity_file_locator).send_keys(path) sleep(3) pass
def click_immediately_release(self): """ 点击'立即发布' :return: """ get_element(self.driver, self.immediatelyrelease_locator).click() pass
def page_factory(self): namelist = ["promptBox", "rejectButton"] ele_dic = page_element_factory(__file__, namelist) self.prompt_box_element = get_element(self.driver, ele_dic['promptBox']) # 选择类别框 self.reject_button_element = get_element( self.driver, ele_dic['rejectButton']) # 选择类别框
def handover(self): self.initial_element() get_element(self.driver, self.icon_send_locator).click() get_element(self.driver, self.select_locator).send_keys(u'嘻嘻') get_element(self.driver, self.select_locator).click() get_element(self.driver, self.forward_locator).click() # 转发 get_element(self.driver, self.hand_over_locator).click() # 确认移交
def _assert_tr_ios(self): # 判断第一个卡片的信息 transport_contract_ukid = get_transport_contract_ukid( self.tr_participant_ukid) # 获取第一个契约id transport_contract_item_ukid = get_transport_contract_item_ukid( transport_contract_ukid) # 获取第一个契约ITEM_ukid print(transport_contract_ukid, transport_contract_item_ukid) transport_contract_info = get_transport_contract_info( self.user_id, transport_contract_ukid, transport_contract_item_ukid) DEPARTURE = str(transport_contract_info['DEPARTURE']) DESTINATIONS = str(transport_contract_info['DESTINATIONS']) DEPARTURE2 = '始发地:' + DEPARTURE DESTINATIONS2 = '目的地:' + DESTINATIONS assert get_element(self.driver, self.tr_type_locator).text == self.type # 判断工种 assert get_element(self.driver, self.tr_no_locator).text == self.no # 判断数量 assert get_element( self.driver, self.tr_unit_one_locator).text == self.unit_hour # 判断计算单位 assert get_element(self.driver, self.tr_origin_locator).text == DEPARTURE2 # 判断开始时间 assert get_element(self.driver, self.tr_end_locator).text == DESTINATIONS2 # 判断结束时间
def page_factory(self): namelist = ["confirmButton", "fourButton"] ele_dic = page_element_factory(__file__, namelist) self.confirm_button_element = get_element( self.driver, ele_dic['confirmButton']) # 选择类别框 self.four_button_element = get_element(self.driver, ele_dic['fourButton']) # 第四个选择框
def _choice_amount_and_submit_android(self, is_choice, proportion, contract_type): """ is_select 为0时不滑动,为1时滑动,proportion为滑动的比例,从0.1到1.0 :param is_choice: int :param proportion: float """ if is_choice == 1 and 0.1 <= proportion <= 1.0: sleep(2) if contract_type == 'SUPPLY': point_ele = get_element( self.driver, self.submit_button_locator) # 获取提交按钮元素,用来计算滑块长度 swipe_button_ele = get_element( self.driver, self.swipe_button_locator) # 获取滑块元素 else: point_ele = get_element( self.driver, self.submit_button_locator2) # 获取提交按钮元素,用来计算滑块长度 swipe_button_ele = get_element( self.driver, self.swipe_button_locator2) # 获取滑块元素 locator_x = point_ele.size[ 'width'] * proportion + point_ele.location['x'] + 10 locator_y = swipe_button_ele.location[ 'y'] + swipe_button_ele.size['height'] / 2 TouchAction(self.driver).long_press(el=swipe_button_ele).\ move_to(x=locator_x, y=locator_y).release().perform() sleep(3) if contract_type == 'SUPPLY': self.action.click(self.submit_button_locator) # 点击确认签订契约 self.action.click(self.confirm_button_locator) # 点击确认签订 else: self.action.click(self.submit_button_locator2) # 点击确认签订契约 self.action.click(self.confirm_button_locator) # 点击确认签订 pass
def page_factory(self): name_list = ['ALIPAY', 'UnionPay', 'ToPay'] ele_dic = page_element_factory(__file__, name_list) self.ALIPAY_element = get_element(self.driver, ele_dic['ALIPAY']) #支付宝 self.UnionPay_element = get_element(self.driver, ele_dic['UnionPay']) #银联 self.ToPay_element = get_element(self.driver, ele_dic['ToPay']) #去支付 pass
def _optimize_address_book_and_invite_link_two_android(self): """ 查看通讯录中邀请人的状态,提前添加一个人在通讯录中 当前添加的这个人在网仓体系下 """ self.action.click(self.choice_locator) self.action.click(self.search_locator) get_element(self.driver, self.name_locator).send_keys('百合')
def click_picking_task(self): self.initial_element() get_element(self.driver, self.starting_position_locator).send_keys('') get_element(self.driver, self.target_position_locator).send_keys('') get_element(self.driver, self.starting_carrier_locator).send_keys('') get_element(self.driver, self.target_carrier_locator).send_keys('') get_element(self.driver, self.complete_button_locator).click() pass
def choice_amount_and_submit(self): """ :param is_choice: int :param proportion: float """ get_element(self.driver, self.enter_for_locator).click() # 报名参加 get_element(self.driver, self.enter_me_locator).click() # 确认报名 pass
def _permission_recovery_three_android(self): self.action.click(self.person_locator) self.action.click(self.search_locator) get_element(self.driver, self.name_locator) self.driver.keyevent(4) self.action.click(self.services_locator) self.action.click(self.sweep_points_locator) self.action.click(self.change_locator) self.action.click(self.recovery_locator) self.action.click(self.sure_locator)
def _optimize_address_book_and_invite_link_two_ios(self): """ 查看通讯录中邀请人的状态,提前添加一个人在通讯录中 当前添加的这个人在网仓体系下 百合:18555090013 """ self.action.click(self.choice_locator) self.action.click(self.search_locator) get_element(self.driver, self.name_locator).set_value('百合') self.action.click(self.com_locator)
def _optimize_address_book_and_invite_link_ios(self): """ 查看通讯录中邀请人的状态,提前添加一个人在通讯录中 当前添加的这个人不在网仓体系下 """ # self.action.click(self.create_locator) self.action.click(self.choice_locator) self.action.click(self.search_locator) get_element(self.driver, self.name_locator).set_value('周锦') self.action.click(self.com_locator)
def _optimize_address_book_and_invite_link_five_android(self): """ 分配权限查看通讯录中邀请人的状态 提前添加一个人在通讯录中 当前分配的这个人已经有该权限 """ self.action.click(self.task_locator) self.action.click(self.permission_locator) self.action.click(self.copy_locator) self.action.click(self.search_locator) get_element(self.driver, self.name_locator).send_keys('的')
def entity_shop_input_information(self): get_element(self.driver, self.input_entity_name_locator).send_keys(u'店大欺人') get_element(self.driver, self.input_entity_address_locator).send_keys(u'黄泉路') get_element(self.driver, self.input_entity_area_locator).send_keys(250) get_element(self.driver, self.click_map_locator).click() sleep(2) DepotMapPage(self.driver).map_first() get_element(self.driver, self.click_next_button_locator).click() pass
def only_one(self, invitee_id): reduction_select(invitee_id) self.image_click(0) get_element(self.driver, self.ta_locator).click() sleep(2) for i in range(3): if is_element_present(self.driver, self.ta_locator): reduction_select(invitee_id) self.image_click(i + 1) get_element(self.driver, self.ta_locator).click() sleep(2) else: break
def _optimize_address_book_and_invite_link_five_ios(self): """ 分配权限查看通讯录中邀请人的状态 提前添加一个人在通讯录中 当前分配的这个人已经有该权限 的:18555090043 """ self.action.click(self.task_locator) self.action.click(self.permission_locator) self.action.click(self.copy_locator) self.action.click(self.search_locator) get_element(self.driver, self.name_locator).set_value('的') self.action.click(self.com_locator)
def FUN_DistributionManagerAndSupervisor(self): # 分配管理者和监控者,都分配给自己 reduction_monitor_and_manager_permissions() # 还原监控者管理者权限 reduction_distribution_manager_and_supervisor_task() # 还原分配监控者和管理者任务 if is_element_present(self.driver, ['ACCESSIBILITY_ID', '分配管理者和监控者']): CardPage(self.driver).distribution_manager_and_supervisor_card( ) # 分配管理者和监控者 get_elements(self.driver, self.assigned_to_me_locator)[0].click() # 监控者分配给我 get_element(self.driver, self.assigned_to_me_locator).click() # 管理者分配给我 get_element( self.driver, self.distribution_success_button_locator).click() # 点击分配成功\ sleep(20) while is_element_present(self.driver, ('ACCESSIBILITY_ID', 'icon back')): get_element(self.driver, ('ACCESSIBILITY_ID', 'icon back')).click() # 不稳定,有时候会跳转进具体卡片,而不是桌面 assert get_distribution_manager_and_supervisor_task_status() == 10 # and judge_manager_and_supervisor_result() is True # sql判断权限 assert is_element_present( self.driver, ('ACCESSIBILITY_ID', '分配管理者和监控者')) is False # 分配管理者和监控者卡片消失 assert get_element(self.driver, ('ACCESSIBILITY_ID', '管理者授权')).get_attribute('name'). \ encode('utf-8') == '管理者授权' # 生成管理者授权 assert get_element(self.driver, ('ACCESSIBILITY_ID', '监控者授权')).get_attribute('name'). \ encode('utf-8') == '监控者授权' # 生成监控者授权
def page_factory(self): name_list = [ 'scan_input', 'start_location', 'target_location', 'complete_btn' ] ele_dic = page_element_factory(__file__, name_list) self.scan_input_element = get_element(self.driver, ele_dic['scan_input']) self.start_location_element = get_element(self.driver, ele_dic['start_location']) self.target_location_element = get_element(self.driver, ele_dic['target_location']) self.complete_btn_element = get_element(self.driver, ele_dic['complete_btn']) pass
def _return_goods_ios(self): """ 申请退货 IOS端 """ self.action.click(self.order_number_locator) get_element(self.driver, self.number_locator).set_values('51860400000008034') self.action.click(self.select_all_locator) self.action.click(self.select_all_locator) self.action.click(self.first_locator) self.action.click(self.mode_locator) self.action.click(self.reject_locator) self.action.click(self.sure_locator) self.action.click(self.return_goods_locator) self.action.click(self.confirm_locator)
def _return_goods_android(self): """ 申请退货 安卓端 """ self.action.click(self.order_number_locator) get_element(self.driver, self.number_locator).send_keys('51860400000008034') self.driver.keyevent(66) self.action.click(self.select_all_locator) self.action.click(self.select_all_locator) self.action.click(self.first_locator) self.action.click(self.mode_locator) self.action.click(self.reject_locator) self.action.click(self.sure_locator) self.action.click(self.return_goods_locator) self.action.click(self.confirm_locator)
def page_factory(self): name_list = ['CloseSyncBtn'] element_metadata_dict = page_element_factory(__file__, name_list) self.CloseSyncBtn_element = get_element( self.driver, element_metadata_dict['CloseSyncBtn']) pass
def page_factory(self): name_list = ['select_SyncCloseCard'] ele_dic = page_element_factory(__file__, name_list) print(ele_dic) self.select_SyncCloseCard_element = get_element( self.driver, ele_dic['select_SyncCloseCard']) pass
def assert_la(self): assert get_element(self.driver, ['ACCESSIBILITY_ID', self.no]).text == self.no # 判断数量 assert get_element(self.driver, ['ACCESSIBILITY_ID', self.no_hour]).text == self.no_hour # 判断时间价钱 assert get_element(self.driver, ['ACCESSIBILITY_ID', self.no_piece]).text == self.no_piece # 判断件价钱 assert get_element(self.driver, ['ACCESSIBILITY_ID', self.unit_hour]).text == self.unit_hour # 判断时间单位 assert get_element(self.driver, ['ACCESSIBILITY_ID', self.unit_piece]).text == self.unit_piece # 判断件单位 assert get_element(self.driver, ['ACCESSIBILITY_ID', self.type]).text == self.type # 判断工种 assert get_element(self.driver, ['ACCESSIBILITY_ID', self.shift]).text == self.shift # 判断班次 assert get_element(self.driver, ['ACCESSIBILITY_ID', self.position]).text == self.position # 判断地址 assert get_element(self.driver, ['ACCESSIBILITY_ID', self.start_time]).text == self.start_time # 判断开始时间 assert get_element(self.driver, ['ACCESSIBILITY_ID', self.end_time]).text == self.end_time
def choice_amount_and_submit(self, is_choice=1): """ is_select 为0时不滑动,为1时滑动 :param is_choice: int :param proportion: float """ if is_choice == 1: tr_line = get_element(self.driver, self.tr_line_locator) tr_line_size = tr_line.size tr_line_location = tr_line.location TouchAction(self.driver).long_press(x=int(tr_line_location['x']) + 1, y=int(tr_line_location['y']) + 2). \ move_to(x=int(tr_line_size['width']), y=0).perform() get_element(self.driver, self.tr_confirmation_contract_locator).click() # 确认签订契约 get_element(self.driver, self.confirm_locator).click() # 我参加
def choice_amount_and_submit(self, is_choice=1): """ is_select 为0时不滑动,为1时滑动 :param is_choice: int :param proportion: float """ # if is_choice == 1: # la_line = get_element(self.driver, self.la_line_locator) # la_line_size = la_line.size # la_line_location = la_line.location # TouchAction(self.driver).long_press(x=int(la_line_location['x']) + 1, # y=int(la_line_location['y']) + 2).\ # move_to(x=int(la_line_size['width']), y=0).perform() get_element(self.driver, self.enter_for_locator).click() #确认签订契约 get_element(self.driver, self.enter_me_locator).click() #我参加 pass
def test_full2573(self): MainPage(self.driver).click_system_service() sleep(2) SystemServiceAgreement(self.driver).click_agreement() sleep(2) MainPage(self.driver).click_deposit() sleep(2) SubmitDeposit(self.driver).click_union_pay() # CIT测试环境 银联测试账号支付 get_element(self.driver, ['ACCESSIBILITY_ID', '下一步']).click() sleep(2) get_element(self.driver, ['ACCESSIBILITY_ID', '免费获取']).click() edit_elements = self.driver.find_elements_by_class_name('UIATextField') edit_elements[-1].set_value("123456") sleep(2) get_element(self.driver, ['ACCESSIBILITY_ID', '完成']).click() get_element(self.driver, ['ACCESSIBILITY_ID', '确认付款']).click() sleep(5) get_element(self.driver, ['ACCESSIBILITY_ID', '返回商户']).click()
def web_input_activation_entity_shop(self, path=None): a = get_elements(self.driver, self.click_activation_locator) a[0].click() # elem = self.driver.find_element_by_css_selector(".position-abs") # try: # script = 'document.getElementsByClassName("position-abs")[0].click()' # ret = self.driver.execute_script(script) # alert = self.driver.switchTo().alert() # alert.sendKeys(path) # c = get_element(self.driver, self.import_commodity_file_locator) # script = '$(".position-abs").click()' # ret = self.driver.execute_script(script) # except Exception as e: # raise e get_element(self.driver, self.import_commodity_file_locator).send_keys(path) sleep(3) pass