fix: screenshot wait for swipe done

This commit is contained in:
debugtalk
2022-09-26 17:41:09 +08:00
parent d4c0fc4cbd
commit 0fd271f19e
3 changed files with 12 additions and 6 deletions

View File

@@ -68,15 +68,15 @@ func (s *veDEMOCRService) getOCRResult(imageBuf []byte) ([]OCRResult, error) {
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected response status code: %d", resp.StatusCode)
}
results, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("read response body error: %v", err)
}
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected response status code: %d, results: %v", resp.StatusCode, string(results))
}
var ocrResult ResponseOCR
err = json.Unmarshal(results, &ocrResult)
if err != nil {
@@ -148,6 +148,7 @@ func (dExt *DriverExt) FindTextByOCR(ocrText string) (x, y, width, height float6
return
}
log.Info().Str("ocrText", ocrText).Msgf("FindText success")
x, y, width, height = dExt.MappingToRectInUIKit(rect)
return
}