画像検証コード識別ソリューションのUIオートメーション



デフ__save_screenshot(自己):
self.driver.save_screenshot( 'full_snap.png')
self.page_snap_obj = Image.open( 'full_snap.png')
self.page_snap_obj返す

デフ__request_re(自己):
self.img = self.driver。 find_element_by_xpath( '// * [ID = "verifyImg" @]')
self.location = self.img.location
self.size = self.img.size
左= self.location [ 'X']
トップ= self.location [ 'Y']
右=は+ self.size [ '幅']左
底=トップ+のself.size [ '高']
ページ=自己.__ save_screenshot()
image_obj = page.crop((左、上、右、下)を)
image_obj.save( 'code002.png')
  
  #别人的接口图片训练识别
#URL1 = 'http://47.106.210.173:19952/captcha/v3'
URL = 'http://47.98.142.71:19952/captcha/v3'
画像=オープン( 'code002.png'、 'RB')
R = requests.post(URL、画像)
T = r.content.decode()
S = json.loads(T)
M = S [ 'メッセージ']
プリント(M)
戻りM

おすすめ

転載: www.cnblogs.com/jinbaobao/p/12017110.html