def modify_mobile(self, mobile_old, trade_password, mobile_new): self.perform_actions( TRADE_PASSWORD, trade_password, # TRADE_PASSWORD_CONFIRM, RECEIVE_SMS, GET_VERIFY_CODE, ) verify_code = MysqlXjbTools().get_sms_verify_code( mobile=mobile_old, template_id='cif_changeMobile') self.perform_actions(TRADE_PASSWORD_VERIFY_CODE_INPUT, verify_code, VERIFY_CODE_CONFIRM, MOBILE, mobile_new, MOBILE_GET_VERIFY_CODE) verify_code = MysqlXjbTools().get_sms_verify_code( mobile=mobile_new, template_id='cif_changeMobile') self.perform_actions( MOBILE_VERIFY_CODE_INPUT, verify_code, MOBILE_CONFIRM, MODIFY_MOBILE_DONE, ) page = LoginPage(self.web_driver) return page
class RegisterPage(PageObject): def __init__(self, web_driver): super(RegisterPage, self).__init__(web_driver) self.elements_exist(*current_page) self._db = MysqlXjbTools() # @message_i_know_afterwards # @message_cancel_afterwards def register(self, phone_number, login_password): self.perform_actions( PHONE_NUMBER, phone_number, GET_VERIFICATION_CODE, PASSWORD, login_password, ) verification_code = self._db.get_sms_verify_code( mobile=phone_number, template_id='cif_register') self.perform_actions( VERIFICATION_CODE_INPUT, verification_code, LOGIN_PASSWORD_CONFIRM, SHOPPING_FIRST, ) page = huaxin_ui.ui_ios_xjb_2_0.home_page.HomePage(self.web_driver) return page @robot_log def register_binding_card(self, phone_number, login_password, trade_password): self.perform_actions(PHONE_NUMBER, phone_number, GET_VERIFICATION_CODE, PASSWORD, login_password) verification_code = self._db.get_sms_verify_code( mobile=phone_number, template_id='cif_register') self.perform_actions( VERIFICATION_CODE_INPUT, verification_code, ) self.perform_actions( LOGIN_PASSWORD_CONFIRM, BINDING_CARD, TRADE_PASSWORD, trade_password, TRADE_PASSWORD, trade_password, TRADE_PASSWORD_CONFIRM, ) page = BindingCardPage(self.web_driver) return page
def binding_card(self, user_name, id_no, band_card_no, phone_number): self.perform_actions( USER_NAME, user_name, ID_NO, id_no, CARD_NO, band_card_no, PHONE_NUMBER, phone_number, GET_VERIFY_CODE, ) verification_code = MysqlXjbTools().get_sms_verify_code( mobile=phone_number, template_id='cif_bindBankCard') self.perform_actions( VERIFY_CODE_INPUT, verification_code, BINDIND_CARD_CONFIRM, BINDIND_CARD_DONE, ) page = huaxin_ui.ui_android_xjb_2_0.home_page.HomePage(self.web_driver) return page
class BankCardResignPage(PageObject): def __init__(self, web_driver): super(BankCardResignPage, self).__init__(web_driver) self._db = MysqlXjbTools() @robot_log def verify_page_title(self, last_no): self.assert_values( '尾号' + last_no + '银行卡重新签约', self.get_text(self.page_title, 'find_element_by_id')) page = self return page @robot_log def resign(self, mobile): self.assert_values( mobile, self.get_text('com.shhxzq.xjb:id/component_cet_mobile', 'find_element_by_id').replace(" ", "")) self.perform_actions(GET_VERIFY_CODE) verification_code = self._db.get_sms_verify_code( mobile=mobile, template_id='cif_bindBankCard') self.perform_actions(VERIFY_CODE_INPUT, verification_code, NEXT) page = huaxin_ui.ui_android_xjb_3_0.user_operation_succeed_page.UserOperationSucceedPage( self.web_driver) return page
def search_fund_products(self, fund_product_name, operation_type=None, mobile=None): if operation_type is None: self.perform_actions(FUND_PRODUCT_INPUT, fund_product_name, FUND_PRODUCT_NAME % fund_product_name) page = huaxin_ui.ui_ios_xjb_3_0.fund_page_fund_detail.FundPageFundDetail( self.web_driver) else: self.perform_actions(FUND_PRODUCT_INPUT, fund_product_name) self.perform_actions(FUND_PRODUCT_NM_CONVERT % fund_product_name) # 当出现购买产品风险高于用户的风险测评结果, 就会出现风险提示, 有些还需要验证码输入. if self.element_exist(u'风险提示', 'find_element_by_accessibility_id'): self.perform_actions(BUY_CONTINUE, ) if self.element_exist("(UIButton_确认)", "find_element_by_accessibility_id"): verify_code = MysqlXjbTools().get_sms_verify_code( mobile=mobile, template_id='as_risk_not_match') self.perform_actions( MOBILE_CODE, verify_code, VERIFY_CODE_CONFIRM, ) page = huaxin_ui.ui_ios_xjb_3_0.fund_convert_page.FundConvertPage( self.web_driver) return page
def binding_card(self, user_name, id_no, bank_card_no, phone_number): self.perform_actions( # USER_NAME, user_name, # ID_TYPE, # FINISH, # ID_NO, id_no, CARD_NO, bank_card_no, # CARD_TYPE, ) self.perform_actions(PHONE_NUMBER, phone_number, GET_VERIFY_CODE) verification_code = MysqlXjbTools().get_sms_verify_code( mobile=phone_number, template_id='cif_bindBankCard') self.perform_actions( VERIFY_CODE_INPUT, verification_code, KEYBOARD_RETURN, # SWIPE_BEGIN, SWIPE_BINDIND_CARD_CONFIRM, 'U', BINDIND_CARD_CONFIRM) page = huaxin_ui.ui_ios_xjb_3_0.binding_card_complete_page.BindingCardCompletePage( self.web_driver) return page
def use_reservation_code(self, trade_password, amount, mobile): self.perform_actions( USE_RESERVATION_CODE, INPUT_AMOUNT, amount, HIDE_KEYBOARD, USE_RESERVATION_CODE_COMFIRM, ) if self.element_exist(u'风险提示', 'find_element_by_accessibility_id'): self.perform_actions(BUY_CONTINUE, ) verify_code = MysqlXjbTools().get_sms_verify_code( mobile=mobile, template_id='as_risk_level') self.perform_actions( MOBILE_CODE, verify_code, VIERY_CODE_CONFIRM, TRADE_PASSWORD, trade_password, BUY_DONE, ) else: self.perform_actions( TRADE_PASSWORD, trade_password, # USE_RESERVATION_CODE_COMPELETED, ) page = huaxin_ui.ui_ios_xjb_3_0.trade_complete_page.TradeCompletePage( self.web_driver) return page
def binding_card(self, band_card_no, phone_number): self.perform_actions( SWIPE_START, SWIPE_STOP, 'U', SWIPE_STOP_CONFIRM, CARD_NO, band_card_no, CARD_TYPE, PHONE_NO, phone_number, GET_VERIFY_CODE, ) verification_code = MysqlXjbTools().get_sms_verify_code( mobile=phone_number, template_id='cif_bindBankCard') self.perform_actions( VERIFY_CODE_INPUT, verification_code, BINDIND_CARD_BLANK, BINDIND_CARD_CONFIRM, BINDIND_CARD_DONE, ) page = self return page
def register_binding_card(self, phone_number, login_password, trade_password): self.perform_actions(PHONE_NUMBER, phone_number, GET_VERIFICATION_CODE, PASSWORD, login_password) verification_code = MysqlXjbTools().get_sms_verify_code( mobile=phone_number, template_id='cif_register') self.perform_actions( VERIFICATION_CODE_INPUT, verification_code, ) self.perform_actions( LOGIN_PASSWORD_CONFIRM, BINDING_CARD, TRADE_PASSWORD, trade_password, TRADE_PASSWORD, trade_password, TRADE_PASSWORD_CONFIRM, ) page = BindingCardPage(self.web_driver) return page
def binding_card(self, bank_card_no, phone_number, flag=0): if flag == 0: self.perform_actions( # SWIPE_START, SWIPE_STOP, 'U', SWIPE_STOP_CONFIRM, ) else: self.perform_actions(BIND_CARD) self.perform_actions( CARD_NO, bank_card_no, # CARD_TYPE, PHONE_NO, phone_number, GET_VERIFY_CODE, ) verification_code = MysqlXjbTools().get_sms_verify_code(mobile=phone_number, template_id='cif_bindBankCard') self.perform_actions( VERIFY_CODE_INPUT, verification_code, # BINDIND_CARD_BLANK, BINDING_CARD_CONFIRM, # BINDIND_CARD_DONE, ) page = huaxin_ui.ui_ios_xjb_3_0.debit_card_add_finish_page.DebitCardAddFinishPage(self.web_driver) return page
def restart_fund_plan(self, trade_password, mobile): self.perform_actions(RESTART, CONFIRM) # 当出现购买产品风险高于用户的风险测评结果, 就会出现风险提示, 有些还需要验证码输入. if self.element_exist(u'风险提示', 'find_element_by_accessibility_id'): self.perform_actions(BUY_CONTINUE, ) verify_code = MysqlXjbTools().get_sms_verify_code( mobile=mobile, template_id='as_risk_not_match') self.perform_actions( MOBILE_CODE, verify_code, VERIFY_CODE_CONFIRM, TRADE_PASSWORD, trade_password, ) else: self.perform_actions( TRADE_PASSWORD, trade_password, BUY_DONE, ) if self.element_exist(u'UIButton_确定', 'find_element_by_accessibility_id'): self.perform_actions(FIRST_BUY_INFO, ) page = self return page
def set_phone_number(self, mobile_new): self.perform_actions(MOBILE, mobile_new, MOBILE_GET_VERIFY_CODE) verify_code = MysqlXjbTools().get_sms_verify_code( mobile=mobile_new, template_id='cif_changeMobile') self.perform_actions(MOBILE_VERIFY_CODE_INPUT, verify_code, MOBILE_CONFIRM) page = huaxin_ui.ui_android_xjb_3_0.user_operation_succeed_page.UserOperationSucceedPage( self.web_driver) return page
def add_credit_card(self, credit_card_no, phone_no): self.perform_actions( CREDIT_CARD_NO, credit_card_no, PHONE_NO, phone_no, GET_VERIFY_CODE, ) _db = MysqlXjbTools() verify_code = _db.get_sms_verify_code(mobile=phone_no, template_id='credit_bind_card') self.perform_actions(INPUT_VERIFY_CODE, verify_code, ADD_CREDIT_CARD_CONFIRM) page = huaxin_ui.ui_android_xjb_3_0.user_operation_succeed_page.UserOperationSucceedPage( self.web_driver) return page
def __init__(self): self._entity_factory = EntityFactory(status=True, concurrent_mode=False) self._mysql = MysqlXjbTools() self._domain_name = GlobalController.RESTFUL_CMS self._common_headers = None self._h5_headers = None # self._current_device_id = None self.current_entity = None self.current_login_token = None
def add_credit_card(self, credit_card_no, phone_no): self.perform_actions( ADD_CREDIT_CARD, CREDIT_CARD_NO, credit_card_no, # CARD_TYPE, PHONE_NO, phone_no, GET_VERIFY_CODE, ) _db = MysqlXjbTools() verify_code = _db.get_sms_verify_code(mobile=phone_no, template_id='credit_bind_card') self.perform_actions(VERIFY_CODE_INPUT, verify_code, ADD_CREDIT_CARD_CONFIRM) page = huaxin_ui.ui_ios_xjb_3_0.credit_card_add_finish_page.CreditCardAddFinishPage( self.web_driver) return page
class BankCardManagementPage(PageObject): def __init__(self, web_driver): super(BankCardManagementPage, self).__init__(web_driver) self.elements_exist(*current_page) self._db = MysqlXjbTools() @robot_log def binding_card(self, band_card_no, phone_number): self.perform_actions( SWIPE_START, SWIPE_STOP, 'U', SWIPE_STOP_CONFIRM, CARD_NO, band_card_no, PHONE_NO, phone_number, GET_VERIFY_CODE, ) verification_code = self._db.get_sms_verify_code( mobile=phone_number, template_id='cif_bindBankCard') self.perform_actions( VERIFY_CODE_INPUT, verification_code, BINDIND_CARD_CONFIRM, BINDIND_CARD_DONE, ) page = self return page @robot_log def delete_band_card(self, trade_password, last_card_no): self.perform_actions( BANK_CARD_FIRST, # BANK_CARD_LAST_CARD_NO % last_card_no, BANK_CARD_OPERATOR, BANK_CARD_DELETE, TRADE_PASSWORD, trade_password, BANK_CARD_DELETE_CONFIRM, ) page = self return page
def add_credit_card(self, credit_card_no, phone_no): time.sleep(3) self.perform_actions( CREDIT_CARD_NO, credit_card_no, PHONE_NO, phone_no, GET_VERIFY_CODE, ) _db = MysqlXjbTools() verify_code = _db.get_sms_verify_code(mobile=phone_no, template_id='credit_bind_card') self.perform_actions( INPUT_VERIFY_CODE, verify_code, ADD_CREDIT_CARD_CONFIRM, ) page = self return page
class SettingModifyMobilePage(PageObject): def __init__(self, web_driver): super(SettingModifyMobilePage, self).__init__(web_driver) self.elements_exist(*current_page) self._db = MysqlXjbTools() @robot_log def modify_mobile(self, mobile_old, trade_password, mobile_new): self.perform_actions( TRADE_PASSWORD, trade_password, TRADE_PASSWORD_CONFIRM, RECEIVE_SMS, GET_VERIFY_CODE, ) verify_code = self._db.get_sms_verify_code( mobile=mobile_old, template_id='cif_changeMobile') self.perform_actions( TRADE_PASSWORD_VERIFY_CODE_INPUT, verify_code, VERIFY_CODE_CONFIRM, MOBILE, mobile_new, MOBILE_GET_VERIFY_CODE, ) verify_code = MysqlXjbTools().get_sms_verify_code( mobile=mobile_new, template_id='cif_changeMobile') self.perform_actions( MOBILE_VERIFY_CODE_INPUT, verify_code, MOBILE_CONFIRM, MODIFY_MOBILE_DONE, ) page = LoginPage(self.web_driver) return page
def __init__(self, app_path, platform_version, device_id, port, package_name): self._db = MysqlXjbTools() Adb().uninstall_apk(device_id, package_name) AppCompatibilityInstall().app_install_handle(device_id, app_path) if not Adb().is_package_installed(device_id, package_name): AppCompatibilityInstall().app_install_handle(device_id, app_path) self.web_driver = WebDriver.Appium().open_android_app( app_path, platform_version, device_id, port) self.main_page = MainPage(self.web_driver) try: button = self.web_driver.find_element_by_xpath( HUA_WEI_ACCESS_ALLOW) button.click() except NoSuchElementException: pass
def login_use_verification_code(self, user_name=None, verification_code='123456', mode='on', return_page=None, flag=None): self.perform_actions(ACCOUNT_SWITCH_CODE) if user_name is not None: self.perform_actions(USER_NAME, user_name) self.perform_actions(GET_VERIFY_CODE) if user_name is not None: verification_code = MysqlXjbTools().get_sms_verify_code( mobile=user_name, template_id='cif_login') if flag == 'modify_mobile': self.assert_values( '您输入的手机号码有误或尚未注册现金宝账号', self.get_text('com.shhxzq.xjb:id/message', 'find_element_by_id')) page = huaxin_ui.ui_android_xjb_3_0.assets_page.AssetsPage( self.web_driver) if mode == 'on': self.perform_actions(VERIFICATION_CODE, verification_code, LOGIN_BUTTON, POP_CANCEL, POP_DIALOG_CLOSE, PERMISSION_CLOSE) page = self._return_page[return_page] elif mode == 'off': self.assert_values( '短信验证码登录', self.get_text('com.shhxzq.xjb:id/sms_login', 'find_element_by_id')) page = self return page
def register(self, phone_number, login_password): self.perform_actions( PHONE_NUMBER, phone_number, GET_VERIFICATION_CODE, ) verification_code = MysqlXjbTools().get_sms_verify_code( mobile=phone_number, template_id='cif_register') self.perform_actions( VERIFICATION_CODE_INPUT, verification_code, PASSWORD, login_password, LOGIN_PASSWORD_CONFIRM, ) page = huaxin_ui.ui_android_xjb_3_0.register_success_page.RegisterSuccessPage( self.web_driver) return page
def login_use_verification_code(self, user_name, can_login=True): self.perform_actions(MESSAGE_LOGIN_BUTTON, USER_NAME, user_name, GET_VERIFY_CODE) if can_login is True: verification_code = MysqlXjbTools().get_sms_verify_code( mobile=user_name, template_id='cif_login') self.perform_actions( VERIFICATION_CODE, verification_code, LOGIN_BUTTON, POP_MESSAGE_CANCEL, ) page = huaxin_ui.ui_ios_xjb_3_0.assets_page.AssetsPage( self.web_driver) else: self.assert_values( False, self.element_exist("(UIButton_获取验证码)", "find_element_by_accessibility_id")) page = self return page
class BindingCardDetailPage(PageObject): def __init__(self, web_driver, device_id=None): super(BindingCardDetailPage, self).__init__(web_driver, device_id) self._db = MysqlXjbTools() @robot_log def verify_page_title(self): self.assert_values( '绑定银行卡', self.get_text('com.shhxzq.xjb:id/title_actionbar_orange', 'find_element_by_id')) page = self return page @robot_log def binding_card(self, bank_card_no, mobile): self.perform_actions( CARD_NO, bank_card_no, PHONE_NO, mobile, GET_VERIFY_CODE, ) verification_code = self._db.get_sms_verify_code( mobile=mobile, template_id='cif_bindBankCard') self.perform_actions(VERIFY_CODE_INPUT, verification_code, BINDIND_CARD_CONFIRM) page = huaxin_ui.ui_ios_xjb_3_0.useroperation_succeed_page.UserOperatinSucceedPage( self.web_driver) return page
class ProductPurchasePage(PageObject): def __init__(self, web_driver): super(ProductPurchasePage, self).__init__(web_driver) self._db = MysqlXjbTools() @robot_log def verify_page_title(self): self.assert_values( '买入', self.get_text(self.page_title, 'find_element_by_id')) page = self return page @robot_log def verify_purchase_amount(self, amount): default_amount_text = self.get_text( 'com.shhxzq.xjb:id/product_purchase_amt', 'find_element_by_id') default_amount = filter(lambda ch: ch in '0123456789.', default_amount_text) if float(amount) <= ASSERT_DICT['max']: self.assert_values('%.2f' % float(amount), default_amount) else: self.assert_values('%.2f' % ASSERT_DICT['max'], default_amount) page = self return page @robot_log def verify_product_purchase_page_details(self, product_name): self.assert_values( '现在买入', self.get_text('com.shhxzq.xjb:id/product_purchase_title', 'find_element_by_id')) self.assert_values( product_name, self.get_text('com.shhxzq.xjb:id/product_name', 'find_element_by_id')) self.assert_values( '剩余额度', self.get_text('com.shhxzq.xjb:id/purchase_limit_title', 'find_element_by_id')) self.assert_values( '买入金额', self.get_text('com.shhxzq.xjb:id/amount_title', 'find_element_by_id')) self.assert_values( '付款账户', self.get_text('com.shhxzq.xjb:id/payment_type_title', 'find_element_by_id')) self.assert_values( 'True', str(self.element_exist("//android.widget.TextView[@text='应付金额']"))) page = self return page @robot_log def buy_finance_product(self, amount, trade_password=None, mobile=None, cash_management_product=None, points='N', nonsuperposed_coupon='N', superposed_coupon='N', age=None): ASSERT_DICT.update({'success_flag': '0'}) self.perform_actions(AMOUNT, amount) if cash_management_product is not None: self.perform_actions( PAYMENT_TYPE, SWIPE_BEGIN, CASH_MANAGEMENT_PRODUCT_SWIPE_STOP % cash_management_product, 'U') if cash_management_product == 'UI作为支付手段异常测试': self.assert_values( '余额不足', self.get_text('com.shhxzq.xjb:id/not_sufficient_prompt', 'find_element_by_id')) page = self return page else: self.perform_actions(CASH_MANAGEMENT_PRODUCT % cash_management_product) if points == 'Y': self.perform_actions(POINT_SWITCH) time.sleep(5) # if nonsuperposed_coupon == 'Y': # self.perform_actions(COUPONS_INFO) # # time.sleep(10) # # self.perform_actions(SWIPE_BEGIN, NONSUPERCOMPOSED_COUPON_SWIPE_STOP, 'U', # COUPONS, # COUPONS_CONFIRM) # # if superposed_coupon == 'Y': # self.perform_actions(COUPONS_INFO) # # time.sleep(10) # self.perform_actions(COUPON_SWIPE_BEGAIN, SUPERCOMPOSED_COUPON_SWIPE_STOP, 'U', # SUPERPOSED_COUPON_1, # SUPERCOMPOSED_COUPON_SWIPE_BEGAIN, SUPERCOMPOSED_COUPON_SWIPE_STOP_1, 'U', # SUPERPOSED_COUPON_2, # COUPONS_CONFIRM) self.perform_actions(SWIPE_BEGIN, COMFIRM_BUTTON_SWIPE_STOP, 'U', BUY_CONFIRM) xjb_assets = ASSERT_DICT['xjb_total_assets_login'] if 1 <= float(amount) < float(xjb_assets): ASSERT_DICT.update({'success_flag': '1'}) if age >= 70: self.assert_values( '风险提示', self.get_text('com.shhxzq.xjb:id/alertTitle', 'find_element_by_id')) self.assert_values( '您已满70周岁,确认继续购买?', self.get_text('com.shhxzq.xjb:id/message', 'find_element_by_id')) self.perform_actions(KEEP_BUY) time.sleep(2) # 数据库数据更新有点滞后 verification_code = self._db.get_sms_verify_code( mobile=mobile, template_id='as_risk_match') self.perform_actions(VERIFY_CODE_INPUT, verification_code, VERIFY_CODE_CONFIRM) if float(amount) >= 5000000: self.assert_values( '风险提示', self.get_text('com.shhxzq.xjb:id/alertTitle', 'find_element_by_id')) self.assert_values( '您的交易金额为500万,确认继续购买?', self.get_text('com.shhxzq.xjb:id/message', 'find_element_by_id')) self.perform_actions(KEEP_BUY) self.assert_values( '输入短信验证码', self.get_text('com.shhxzq.xjb:id/tv_dialog_title', 'find_element_by_id')) self.assert_values( True, self.element_exist( "//android.widget.Button[contains(@text,'后重发')]")) self.assert_values( True, self.element_exist("//android.widget.Button[@text='确认']")) page = self else: self.perform_actions(TRADE_PASSWORD, trade_password) page = huaxin_ui.ui_android_xjb_3_0.user_operation_succeed_page.UserOperationSucceedPage( self.web_driver) elif float(amount) > float(xjb_assets): self.perform_actions(CANCEL_BUTTON) page = self else: page = self return page
def __init__(self, web_driver): super(BankCardManagementPage, self).__init__(web_driver) self.elements_exist(*current_page) self._db = MysqlXjbTools()
def __init__(self, web_driver): super(RegisterPage, self).__init__(web_driver) self.elements_exist(*current_page) self._db = MysqlXjbTools()
def __init__(self, web_driver, device_id=None): super(BindingCardDetailPage, self).__init__(web_driver, device_id) self._db = MysqlXjbTools()
def __init__(self, web_driver): super(ProductPurchasePage, self).__init__(web_driver) self._db = MysqlXjbTools()
def buy_finance_product(self, mobile, amount, trade_password, cash_management_product=None, points='N', non_superposed_coupon=None, superposed_coupon=None, cash_management='N'): ASSERT_DICT.update({'success_flag': '0'}) if self.element_exist(AMOUNT_LOCATOR): self.perform_actions(AMOUNT, amount) else: self.perform_actions(FUND_BUY_AMOUNT, amount) self.perform_actions(HIDE_KEYBOARD) if cash_management == 'Y': if self.element_exist('(HXShowPaytypeCell)', 'find_element_by_accessibility_id'): self.perform_actions(PAYMENT_TYPE) else: self.perform_actions(PAYMENT_TYPE_FUND) # 获取现金管理产品的余额 left_amount = self.get_text( "//UIAStaticText[@label='%s']/following-sibling::UIAStaticText[1]" % cash_management_product) left_amount = '%.2f' % float(filter(lambda ch: ch in '0123456789.', left_amount)) ASSERT_DICT.update({'left_amount': left_amount}) self.perform_actions(CASH_MANAGEMENT_PRODUCT % cash_management_product) if points == 'Y': self.perform_actions(USE_POINTS) usable_points = self.get_text("//UIASwitch") usable_points = '%.2f' % float(filter(lambda ch: ch in '0123456789.', usable_points)) ASSERT_DICT.update({'usable_points': usable_points}) if non_superposed_coupon == 'Y': self.perform_actions(USE_COUPON) self.perform_actions( "swipe_accId_//", COUPON_2_STOP, "U", COUPON_2, COUPON_CONFIRM, ) if superposed_coupon == 'Y': self.perform_actions( USE_COUPON, "swipe_accId_//", COUPON_1_STOP, "U", COUPON_1, COUPON_1_STOP, COUPON_1_2_STOP, "U", COUPON_1_2, COUPON_CONFIRM, ) if self.element_exist("(UIButton_确认)", "find_element_by_accessibility_id"): self.perform_actions(BUY_CONFIRM) else: self.perform_actions(BUY_CONFIRM_FUND) if self.element_exist(u'您已经购买过定期宝产品,不能购买新手专享产品', 'find_element_by_accessibility_id'): self.perform_actions( POP_CONFIRM, ) page = self return page # 当出现购买产品风险高于用户的风险测评结果, 就会出现风险提示, 有些还需要验证码输入. if self.element_exist(u'风险提示', 'find_element_by_accessibility_id'): self.perform_actions( BUY_CONTINUE, ) if self.element_exist("(UIButton_确认)", "find_element_by_accessibility_id"): verify_code = MysqlXjbTools().get_sms_verify_code(mobile=mobile, template_id='as_risk_not_match') self.perform_actions( MOBILE_CODE, verify_code, VERIFY_CODE_CONFIRM, ) self.perform_actions( TRADE_PASSWORD, trade_password, BUY_DONE, ) if self.element_exist(u'UIButton_确定', 'find_element_by_accessibility_id'): self.perform_actions( FIRST_BUY_INFO, ) page = huaxin_ui.ui_ios_xjb_3_0.trade_complete_page.TradeCompletePage(self.web_driver) return page
def __init__(self, web_driver): super(SettingModifyMobilePage, self).__init__(web_driver) self.elements_exist(*current_page) self._db = MysqlXjbTools()