示例#1
0
文件: main.py 项目: wanglibao8/H5
def img_check():
    ImgCheck = Action.ImgCheck
    hash_1, hash_3 = get_filelist("current_img/", ImgCheck)
    hash_2, hash_4 = get_filelist("original_img/", ImgCheck)
    alarm = Action.AlarmDingDing()
    for k in hash_1:
        try:
            a1, a2 = hash_1[k], hash_3[k]
            b1, b2 = hash_2[k], hash_4[k]
            c1 = ImgCheck.cmpHash(a1, b1)
            c2 = ImgCheck.cmpHash(a2, b2)
            print(c1, c2)
            print(k)
            if c1 >= 10:
                tag = time.strftime("%Y-%m-%d-%H-%M", time.localtime())
                copy_file("current_img/"+k, tag+k)
                alarm.dataFormat(event_name="H5", event_type="img 差值校验", gameName=k,
                                 curr_url="http://39.106.183.113/H5/hash_img/" + tag+k, orig_url="http://39.106.183.113"
                                                                                                "/H5/original_img/" + k)
            if c2 >= 10:
                tag = time.strftime("%Y-%m-%d-%H-%M", time.localtime())
                copy_file("current_img/"+k, tag+k)
                alarm.dataFormat(event_name="H5", event_type="img  方差校验", gameName=k,
                                 curr_url="http://39.106.183.113/H5/hash_img/" + tag+k, orig_url="http://39.106.183.113"
                                                                                                "/H5/original_img/" + k)
        except:
            pass
示例#2
0
文件: main.py 项目: wanglibao8/H5
def wzry_screen_page(sections, path, url, H5_PAGE=None):
    """
    元素截图
    :param num: 重试次数
    :param wzry:
    :param sections:
    :param path:
    :return:
    """
    global i, actions, wzry
    config = Action.config
    action_version = config.getConfig("H5.conf", "version", "wzry_version")
    wzry_version = config.getConfig("version/version.conf", "version", "wzry_version")
    for section in sections:
        options_list = config.getOptions(section)
        # options_list_click = config.getOptions(section + '_click')
        count = 0
        while count <= 5:
            try:
                wzry = Action.H5Check(url)
                for i in options_list:
                    actions = config.getConfig("H5.conf", section, i)
                    print(i)
                    print(actions)
                    if "close" in i:
                        wzry.click(actions)
                        time.sleep(1)
                    elif "action" in i:
                        wzry.click(actions)
                        time.sleep(5)
                    else:
                        wzry.screebshot_ele(actions, path[0], i)
                        if action_version != wzry_version:
                            wzry.screebshot_ele(actions, path[1], i)
                wzry.quit()
                break
            except Exception as e:
                if count == 5:
                    wzry.screenshot("error_img/", i)
                    alarm = Action.AlarmDingDing()
                    print("alarm.....")
                    if "action" in i or "close" in i:
                        alarm.dataFormat(event_name=H5_PAGE, event_type="元素不存在", gameName=actions,
                                         curr_url="http://39.106.183.113"
                                                  "/H5/error_img/" + i + '.png',
                                         orig_url="页面按钮{}不存在。".format(i))
                    else:
                        alarm.dataFormat(event_name=H5_PAGE, event_type="元素不存在", gameName=actions,
                                         curr_url="http://39.106.183.113"
                                                  "/H5/error_img/" + i + '.png',
                                         orig_url="http://39.106.183.113"
                                                  "/H5/original_img/" + i + '.png')
                count += 1
                print(e)
                wzry.quit()
示例#3
0
文件: main.py 项目: wanglibao8/H5
def img_collect(wzry, img_section):
    """
    收集幸运折扣中设计的img
    :param img_section:
    :param wzry:
    :return:
    """
    config = Action.config
    action_version = config.getConfig("H5.conf", "version", "wzry_version")
    wzry_version = config.getConfig("version/version.conf", "version", "wzry_version")
    ImgCheck = Action.ImgCheck
    options_list = config.getOptions(img_section)
    for i in options_list:
        if "action" in i:
            action = config.getConfig("H5.conf", img_section, i)
            try:
                wzry.click(action)
            except Exception as e:
                print(e)
                wzry.quit()
                exit()
        elif "close" in i:
            action = config.getConfig("H5.conf", img_section, i)
            try:
                wzry.click(action)
            except Exception as e:
                print(e)
                wzry.quit()
                exit()
        else:
            print(i)
            element_img = config.getConfig("H5.conf", img_section, i)
            try:
                img_url = wzry.collect_img(element_img)
                print(img_url)
                filename = os.path.basename(img_url)
                print(filename)
                ImgCheck.download_img(img_url, "current_img/", filename)
                if action_version != wzry_version:
                    ImgCheck.download_img(img_url, "original_img/", filename)
            except Exception as e:
                print(e)
                wzry.screenshot("error_img/", i)
                alarm = Action.AlarmDingDing()
                alarm.dataFormat(event_name="H5_WZRY", event_type="元素不存在", gameName=element_img,
                                 curr_url="http://39.106.183.113"
                                          "/H5/error_img/" + i + '.png',
                                 orig_url=".....")
示例#4
0
文件: main.py 项目: wanglibao8/H5
def wzry_actions(config, wzry, section, path):
    """
    点击客服,提交意见,时长兑换
    :param path:
    :param config:
    :param section:
    :param wzry:
    :return:
    """

    options_list = config.getOptions(section)
    for i in options_list:
        actions = config.getConfig("H5.conf", section, i)
        if i == "send_keys":
            wzry.send_comments(actions, "测试!!!")
        elif "onback" in i:
            try:
                wzry.click(actions)
            except Exception as e:
                print(e)
                wzry.quit()
                exit()
        elif "close" in i:
            try:
                wzry.click(actions)
            except Exception as e:
                print(e)
                # wzry.quit()
                # exit()
        else:
            print(i)
            filename = section + "_" + i
            print(filename)
            try:
                wzry.click(actions)
                wzry.screenshot(path, filename)
                # wzry.screebshot_ele(actions, path, i)
            except Exception as e:
                wzry.screenshot("error_img/", filename)
                alarm = Action.AlarmDingDing()
                alarm.dataFormat(event_name="H5_WZRY", event_type="元素不存在", gameName=actions,
                                 curr_url="http://39.106.183.113"
                                          "/H5/error_img/" + filename + '.png',
                                 orig_url="http://39.106.183.113"
                                          "/H5/original_img/" + filename + '.png')
                print(e)
                wzry.quit()
                exit()