def get_receiptpaymoney(): #获取提交订单时计算的实付金额 receipt_value = PageAction.getelement_attribute(read_file.get_option( 'workbench', 'real_receipt'), attr='value') # receipt = float(receipt_value) # 现金支付模块:实付金额浮点型 print('订单实付金额:%s' % (receipt_value)) PageAction.click(read_file.get_option('workbench', 'cash_pay_button')) PageAction.pause(2) return receipt_value
def login(): # helper.open_browser('chrome') # helper.open_url() #从配置读取用户信息 userName = Parse_JYH_Config().get_option(sectionName='account_info', option='station_username') #输入用户名 PageAction.input_string(read_file.get_option('login', 'userName'), content=userName) password = Parse_JYH_Config().get_option(sectionName='account_info', option='station_password') # 输入密码 PageAction.input_string(read_file.get_option('login', 'password'), content=password) # 输入验证码 txtCode = Parse_JYH_Config().get_option(sectionName='account_info', option='txtCode') PageAction.input_string(read_file.get_option('login', 'txtCode'), content=txtCode) #点击登录 PageAction.click(read_file.get_option('login', 'login_button')) #校验页面元素,左侧侧边栏文本包含'工作台' find.getElement(read_file.get_option('login', 'workbench'), seconds=14) print('账号%s登录成功!' % (userName))
def workbench_payment(): enter_workbench.enter_workbenchpage() PageAction.click(locatorMethod='xpath',localExpression='//div[.="收款"]') while True: PageAction.input_string(locatorMethod='id',localExpression='cardNoPhone',content='15806049674') # cardNoPhone_elem=find.getElement(localType='id', localExpression='cardNoPhone') cardNoPhone_value=PageAction.getelement_attribute(locatorMethod='id', localExpression='cardNoPhone',attr='value') if len(cardNoPhone_value)==11: print('成功输入11位手机号码:',cardNoPhone_value) break else: print('手机号码位数错误,重输',cardNoPhone_value) PageAction.pause(1) PageAction.press_enter_key() PageAction.pause(2) #定位枪号元素且输入汽油枪号10 PageAction.input_string(locatorMethod='id',localExpression="gunNo",content=config_handler.Parse_JYH_Config().get_option('gunNo_info','diese_gunNo')) PageAction.press_enter_key() PageAction.pause(5) #优惠券内容 # coupon =find.getElement(localType='xpath',localExpression='//label[@title="优惠券"]/parent ::*/following-sibling::*/div/span/div').text #清空优惠券 PageAction.click_SvgelementXpath(locatorMethod='xpath',localExpression="//span[@class='ant-form-item-children']/i/*[name()='svg']/*[name()='path'][2]") PageAction.pause(2)
def Cash_payment_click(): #支付方式按钮:现金支付 return PageAction.click( read_file.get_option('workbench', 'cash_pay_button')) PageAction.pause(2)
def Balance_payment_click(): #支付方式按钮:余额支付 return PageAction.click( read_file.get_option('workbench', 'Balance_pay_button')) PageAction.pause(10)
def click_pay(): # 收款操作 PageAction.click(read_file.get_option('workbench', 'submit_pay')) PageAction.pause(3)
def workbench_payment(): enter_workbenchpage() PageAction.click(localtion=read_file.get_option('workbench', 'pay_button')) PageAction.pause(3)
def close_fail_pay_Popup(): #关闭支付失败弹窗 PageAction.pause(2) PageAction.click(read_file.get_option('workbench', 'cancle_button'))
def close_success_pay_Popup(): PageAction.pause(2) #关闭支付成功确定按钮 PageAction.click(read_file.get_option('workbench', 'close_enter'))
def min_payment_windows(): #最小化收款弹窗 PageAction.click(read_file.get_option('workbench', 'min_pay')) # Action.click(locatorMethod='xpath', localExpression='//button[@aria-label="Close"]/following-sibling::*[1]/div') PageAction.pause(3)