Esempio n. 1
0
def companyPassForget(driver, Act, Type):
    waitUntilClick(driver, path_backStage_authentication.btn_forPass_css.value)
    sleep(1)
    driver.find_element_by_css_selector(
        path_backStage_authentication.btn_forPass_css.value).click()
    waitUntilClick(driver, loginOn.btn_next_css.value)
    sleep(0.5)
    driver.find_element_by_css_selector(
        loginOn.input_actForget_css.value).send_keys(Act)
    driver.find_element_by_css_selector(
        loginOn.input_codeForget_css.value).send_keys(' ')
    waitUntilClick(driver, loginOn.btn_phoneCodeForget_css.value)
    sleep(0.5)
    flushDb()
    driver.find_element_by_css_selector(
        loginOn.btn_phoneCodeForget_css.value).click()
    while 1:
        if Type == 1:
            message = getPhoneMessage().get("actBank")
        else:
            message = getPhoneMessage().get("actRisk")
        if message is None:
            sleep(1)
            continue
        else:
            break
    message = message.strip().strip('"')
    el = driver.find_element_by_css_selector(
        loginOn.input_phoneCodeForget_css.value)
    el.send_keys(Keys.LEFT)
    el.send_keys(message)
    el.send_keys(Keys.DELETE)
    # 密码重置页面
    waitUntilClick(driver, loginOn.btn_next_css.value)
    sleep(0.5)
    driver.find_element_by_css_selector(loginOn.btn_next_css.value).click()
    waitUntilDisplay(driver, loginOn.btn_nextPwd_css.value)
    logger.info("成功进入到密码重置页面")
    sleep(0.5)
    driver.find_element_by_css_selector(
        loginOn.input_pwdForget_css.value).send_keys('123456')
    driver.find_element_by_css_selector(
        loginOn.input_pwdConfirm_css.value).send_keys('123456')
    driver.find_element_by_css_selector(loginOn.btn_nextPwd_css.value).click()
    # 修改完成画面
    sleep(2)
    logger.info("成功进入到密码修改完成页面")
Esempio n. 2
0
def companyPassForgetForward(act):
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.get(url_forward)
    logger.info("登录页面")
    waitUntilClick(driver, loginOn.href_passForget_css.value)
    sleep(1)
    driver.find_element_by_css_selector(
        loginOn.href_passForget_css.value).click()
    waitUntilClick(driver, loginOn.btn_nextPwd1_css.value)
    logger.info("安全验证页面")
    driver.find_element_by_css_selector(
        loginOn.input_phoneNum_css.value).send_keys(act)
    driver.find_element_by_css_selector(
        loginOn.input_veryCode_css.value).send_keys(' ')
    flushDb()
    driver.find_element_by_css_selector(
        loginOn.btn_phoneVeryCode_css.value).click()
    while 1:
        message = getPhoneMessage().get("forgeMes")
        if message is None:
            sleep(1)
            continue
        else:
            break
    driver.find_element_by_css_selector(
        loginOn.input_phoneVeryCode_css.value).send_keys(
            message.strip().strip('"'))

    driver.find_element_by_css_selector(loginOn.btn_nextPwd1_css.value).click()
    waitUntilClick(driver, loginOn.btn_nextPwd2_css.value)
    logger.info("重置密码页面")
    driver.find_element_by_css_selector(
        loginOn.input_newPwd_css.value).send_keys(pwd)
    driver.find_element_by_css_selector(
        loginOn.input_newPwdCon_css.value).send_keys(pwd)

    driver.find_element_by_css_selector(loginOn.btn_nextPwd2_css.value).click()
    sleep(1)
    driver.quit()
Esempio n. 3
0
def test_companyRegister():
    if runMode == 'UI':
        def_name = sys._getframe().f_code.co_name
        test_Assert = Assert.Assertions(def_name)
        logger.info("开始执行脚本%s:\n", def_name)

        if jenkins:
            option = webdriver.ChromeOptions()
            option.add_argument('headless')  # 浏览器不提供可视化页面
            option.add_argument('no-sandbox')  # 以最高权限运行
            option.add_argument('--start-maximized')  # 最大化运行(全屏窗口)设置元素定位比较准确
            option.add_argument('--disable-gpu')  # 谷歌文档提到需要加上这个属性来规避bug
            option.add_argument('--window-size=1920,1080')  # 设置浏览器分辨率(窗口大小)
            driver = webdriver.Chrome(options=option)
        else:
            driver = webdriver.Chrome(executable_path=driverPath)
        driver.maximize_window()
        driver.get(url_ui_register)
        # db中清除已注册的账户
        deleteInforMobile()
        logger.info("对已注册的账户进行删除操作")
        sleep(1)
        waitUntilClick(driver, loginOn.btn_agree_css.value)
        driver.find_element_by_css_selector(
            loginOn.btn_agree_css.value).click()

        waitUntilDisplay(driver, loginOn.input_act_css.value)
        driver.find_element_by_css_selector(
            loginOn.input_act_css.value).send_keys(act)
        driver.find_element_by_css_selector(
            loginOn.input_pwd_css.value).send_keys(pwd)
        driver.find_element_by_css_selector(
            loginOn.input_conPwd_css.value).send_keys(pwd)
        waitUntilClick(driver, loginOn.btn_phoneCode_css.value)
        sleep(2)
        flushDb()
        driver.find_element_by_css_selector(
            loginOn.btn_phoneCode_css.value).click()

        while 1:
            message = getPhoneMessage().get("regMes")
            if message is None:
                sleep(0.5)
                continue
            else:
                break

        driver.find_element_by_css_selector(
            loginOn.input_phoneCode_css.value).send_keys(
                message.strip().strip('"'))
        waitUntilClick(driver, loginOn.btn_agreeReg.value)
        driver.find_element_by_css_selector(loginOn.btn_agreeReg.value).click()

        title = driver.title
        test_Assert.assert_text_ui(title, '中小微企业金融服务聚合平台')
        logger.info("注册成功,返回到登陆页面")
        sleep(1)
        driver.quit()
    else:
        # touch(Template(r"C:\Users\shaojunshuai\PycharmProjects\AutoTest-python\Auto_Test\test_data\picture\id_5.png"))
        logger.info("小程序自动化测试开始")
        startWeinxin()
        deleteInforMobile()  # 删除个人信息
        # clearCache()
        picture_dir1 = os.getcwd() + '\\test_data\\picture\\id_9.png'
        touch(Template(picture_dir1))
        waiteForClick(mobileDriver(text='允许'))
        waiteForClick(mobileDriver(text='授权手机号'))
        waiteForClick(mobileDriver(text='允许'))

        # companyPassForgetForward(act)
        logger.info("小程序个人实名认证页面")

        # 上传身份证正反面
        waiteForClick(mobileDriver(text='请上传身份证头像面'))
        waiteForClick(mobileDriver(text='所有图片'))
        waiteForClick(mobileDriver(text='自动化测试专用相册'))
        mobileDriver("android.widget.LinearLayout").offspring(
            "com.tencent.mm:id/dm6").child("com.tencent.mm:id/f4b")[3].child(
                "com.tencent.mm:id/dm0").click()
        waiteForClick(mobileDriver(text='完成'))
        sleep(3)
        waiteForClick(mobileDriver(text='请上传身份证国徽面'))
        waiteForClick(mobileDriver(text='所有图片'))
        waiteForClick(mobileDriver(text='自动化测试专用相册'))
        mobileDriver("android.widget.LinearLayout").offspring(
            "com.tencent.mm:id/dm6").child("com.tencent.mm:id/f4b")[2].child(
                "com.tencent.mm:id/dm8").click()
        waiteForClick(mobileDriver(text='完成'))
        sleep(1)
        waiteForClick(mobileDriver(text='提交认证'))
        # 活体认证欺诈性校验
        getVerification()
        # 等待直到元素消失
        while True:
            if mobileDriver(text='身份证有效期至').exists():
                break
            else:
                continue
        picture_dir = os.getcwd() + '\\test_data\\picture\\id_6.png'
        touch(Template(picture_dir))
Esempio n. 4
0
def authentication(driver, Type):
    if Type == 1:
        backStageLogin(driver, company_bank, company_bank_pass, 1)
    else:
        backStageLogin(driver, company_Guarantee, company_Guarantee_pass, 1)
    sleep(3)
    flushDb()
    driver.find_element_by_css_selector(
        path_backStage_authentication.btn_codeAu_css.value).click()
    while 1:
        if Type == 1:
            message = getPhoneMessage().get("AuBank")
        else:
            message = getPhoneMessage().get("AuRisk")
        if message is None:
            sleep(1)
            continue
        else:
            break
    message = message.strip().strip('"')
    driver.find_element_by_css_selector(
        path_backStage_authentication.input_codeAu_css.value).send_keys(
            message)
    picture_dir1 = os.getcwd() + '\\test_data\\picture\\id_1.jpg'
    picture_dir2 = os.getcwd() + '\\test_data\\picture\\id_2.jpg'
    picture_dir3 = os.getcwd() + '\\test_data\\picture\\id_3.jpg'
    driver.find_element_by_css_selector(
        path_backStage_authentication.upload_pic1_css.value).send_keys(
            picture_dir1)
    driver.find_element_by_css_selector(
        path_backStage_authentication.upload_pic2_css.value).send_keys(
            picture_dir2)
    sleep(1)
    driver.find_element_by_css_selector(
        path_backStage_authentication.btn_submitAu_css.value).click()
    # 企业信息认证
    logger.info('企业信息认证')
    waitUntilClick(driver, path_backStage_authentication.btn_goToAu_css.value)
    sleep(1)
    driver.find_element_by_css_selector(
        path_backStage_authentication.input_soCode_css.value).send_keys(
            '515328000000000510')
    driver.find_element_by_css_selector(
        path_backStage_authentication.input_layName_css.value).send_keys('黄晓明')
    driver.find_element_by_css_selector(
        path_backStage_authentication.input_IdCardLay_css.value).send_keys(
            '110101199003077774')
    sleep(1)
    driver.find_element_by_css_selector(
        path_backStage_authentication.input_addressLay_css.value).send_keys(
            '陆家嘴金砖大厦')
    driver.find_element_by_css_selector(
        path_backStage_authentication.input_postLay_css.value).send_keys(
            '220000')

    driver.find_element_by_css_selector(
        path_backStage_authentication.upload_pic3_css.value).send_keys(
            picture_dir3)

    driver.find_element_by_css_selector(
        path_backStage_authentication.btn_goToAu_css.value).click()

    logger.info('协议内容确认页面')
    waitUntilClick(
        driver,
        '#root > div > section > section > main > div > div > div > div > div > div:nth-child(2) > div > button'
    )
    driver.find_element_by_css_selector(
        path_backStage_authentication.checkBox_agree_css.value).click()
    sleep(0.5)
    driver.find_element_by_css_selector(
        path_backStage_authentication.btn_startAu_css.value).click()
    if Type == 0:
        # 活体认证欺诈性校验(担保公司)
        getVerification_ui(RequestURL, company_Guarantee)
    else:
        # 活体认证欺诈性校验(银行)
        getVerification_ui(RequestURL, company_bank)
    logger.info('二维码认证页面')
    while True:
        try:
            text = driver.find_element_by_css_selector(
                path_backStage_authentication.text_au_css.value).text
            if text == '认证成功':
                break
        except:
            sleep(0.5)
            continue
    if Type == 0:
        driver.quit()
Esempio n. 5
0
def loanApply(driver_forward):
    sleep(2)
    productChoose(driver_forward)
    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.select_productQuery_css.value).click()
    waitUntilClick(driver_forward, path_Tripartite_interaction.btn_productSubmit_css.value)
    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.btn_productSubmit_css.value).click()

    logger.info('进入收款账户管理画面')

    waitUntilClick(driver_forward, path_Tripartite_interaction.btn_next_css.value)
    sleep(1)
    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.input_bankNumMan_css.value).send_keys(
        '12222221222222')
    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.input_bankPhone_css.value).send_keys(
        company_user)
    flushDb()
    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.btn_veryCod_css.value).click()
    while 1:
        message = getPhoneMessage().get("loanMes")
        if message is None:
            sleep(0.5)
            continue
        else:
            break
    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.input_veryCod_css.value).send_keys(
        message.strip().strip('"'))

    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.btn_next_css.value).click()

    logger.info('银行卡已经添加')

    logger.info('进入借款申请画面')
    sleep(2)
    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.select_act_css.value).click()
    sleep(0.5)
    driver_forward.find_element_by_xpath("//*[text() = '12222221222222']").click()
    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.input_loanMoney_css.value).send_keys(
        '90000')
    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.input_loanMonth_css.value).send_keys(
        '12')

    while True:
        try:
            driver_forward.find_element_by_css_selector(
                path_Tripartite_interaction.select_repaymentWay_css.value).click()
            sleep(1)
            driver_forward.find_element_by_xpath("//*[text() = '随借随还']").click()
            break
        except:
            continue
    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.input_reason_css.value).send_keys(
        '政府项目借贷')

    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.checkBox_agreeLoan_css.value).click()
    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.btn_submitLoan_css.value).click()
    # 点击返回
    while True:
        # 活体认证欺诈性校验
        try:
            sleep(5)
            getVerification()
            break
        except:
            continue
    WebDriverWait(driver_forward, 1200).until(
        EC.presence_of_element_located((By.CSS_SELECTOR, path_Tripartite_interaction.text_back_css.value)))
    driver_forward.find_element_by_css_selector(path_Tripartite_interaction.btn_myMain_css.value).click()