Ejemplo n.º 1
0
 def login(self):
     self.driver = webdriver.Chrome()
     self.sys_o = SeleniumDriver(self.driver)
     self.sys_h = BaseHandle(self.driver)
     self.driver.get('http://192.168.1.164:27979/zl/179333')
     self.sys_o.handle_windows("max")
     self.sys_o.send_value('登录', "username", "admin")
     self.sys_o.send_value('登录', "password", "zl123456zl")
     try:
         # 截取验证码
         self.driver.save_screenshot("C:/ZL_testing/image/ZL.png")
         code_element = self.sys_o.get_element('登录', "yanzm")
         left = code_element.location['x']
         top = code_element.location['y']
         right = code_element.size['width'] + left
         height = code_element.size['height'] + top
         im = Image.open('C:/ZL_testing/image/ZL.png')
         img = im.crop((left, top, right, height))
         img1 = img.resize((1024, 728))
         img1.save("C:/ZL_testing/image/yanzm.png")
         # 图片转base64
         f = open('C:/ZL_testing/image/yanzm.png', 'rb')  # 第一个参数图像路径
         ls_f = base64.b64encode(f.read())
         f.close()
         # Showapi识别验证码 精度高, 不免费
         r = ShowapiRequest("http://route.showapi.com/184-5", "126468",
                            "b76ac488b076469ea5f5a19d109e1bd3")
         r.addBodyPara("img_base64", ls_f)
         r.addBodyPara("typeId", "34")
         r.addBodyPara("convert_to_jpg", "0")
         r.addBodyPara("needMorePrecise", "0")
         res = r.post()
         yanzm_test = res.json()['showapi_res_body']['Result']
         '''
         # pytesseract识别验证码 精度低, 免费
         img1 = Image.open("C:/ZL_testing/image/yanzm.png")
         test = pytesseract.image_to_string(img1)
         '''
         self.sys_o.send_value('登录', "yanzm_key", yanzm_test)
     except:
         pass
     self.sys_o.click_element('登录', 'login')
Ejemplo n.º 2
0
    def __init__(self, driver):
        self.handle = BaseHandle(driver)
        self.unit_chengzu = unit_chengzu_page.chengzu(driver)
        self.unit_chuzu = unit_chuzu_page.ChuzPage(driver)
        self.unit_dengz = unit_dengzgl_page.DengzglPage(driver)
        self.unit_touz = unit_duiwtz_page.DuiwtzPage(driver)
        self.unit_peiz = unit_peiz_page.PeizlPage(driver)
        self.unit_shouy = unit_shouy_page.ShouyPage(driver)
        self.unit_weix = unit_weixgl_page.WeixglPage(driver)
        self.unit_yans = unit_yansgl_page.YansglPage(driver)
        self.unit_chuz = unit_ziccz_page.ZicczPage(driver)
        self.unit_fenp = unit_zicfp_page.ZicfpPage(driver)
        self.unit_shouh = unit_zicsh_page.ZicshPage(driver)
        self.unit_zhuany = unit_ziczy_page.ZiczyPage(driver)
        self.unit_shouygl = unit_shouygl_page.ShouyglPage(driver)

        self.fin_hex = fin_hexzc_page.HexzcPage(driver)
        self.fin_shouy = fin_shouy_page.ShouyiPage(driver)
        self.fin_weix = fin_weix_page.FinWeixPage(driver)
        self.fin_dengz = fin_xinzzc_page.XinzzcPage(driver)

        self.dep_guih = dep_guih_page.DepGuihPage(driver)
        self.dep_peiz = dep_peiz_page.DepPeizlPage(driver)
        self.dep_shouy = dep_shouy_page.DepShouyPage(driver)
        self.dep_weix = dep_weixgl_page.DepWeixglPage(driver)
        self.dep_yans = dep_yansgl_page.DepYansglPage(driver)
        self.dep_ziccz = dep_ziccz_page.DepZicczPage(driver)
        self.dep_fenp = dep_zicfp_page.DepZicfpPage(driver)
        self.dep_shouh = dep_zicsh_page.DepZicshPage(driver)
        self.dep_zhuany = dep_ziczy_page.DepZiczyPage(driver)

        self.user_chuz = user_chuz_page.UserZicczPage(driver)
        self.user_guih = user_guih_page.UserGuihPage(driver)
        self.user_shenl = user_shenl_page.UserShenllPage(driver)
        self.user_shouy = user_shouy_page.UserShouyPage(driver)
        self.user_zhuany = user_zhuany_page.UserZhuanyPage(driver)
        self.user_weix = user_weix_page.UserWeixPage(driver)
        self.user_yans = user_yans_page.UserYansPage(driver)
Ejemplo n.º 3
0
 def __init__(self, driver):
     self.handle = BaseHandle(driver)