Skip to content

Commit

Permalink
Merge pull request #107 from ctripcorp/105-依赖包安装优化
Browse files Browse the repository at this point in the history
chore:add exception info
  • Loading branch information
clgwlg authored Aug 24, 2022
2 parents a0b10a0 + 0b945e8 commit 936d935
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions flybirds/core/plugin/plugins/default/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import flybirds.utils.uuid_helper as uuid_helper
from flybirds.core.global_context import GlobalContext as g_Context
from flybirds.core.plugin.plugins.default.ios_snapshot import get_screen
from flybirds.core.exceptions import FlybirdsException


class BaseScreen:
Expand Down Expand Up @@ -104,6 +105,18 @@ def image_ocr(img_path):
"""
log.debug(f"[image ocr path] image path is:{img_path}")
ocr = g_Context.ocr_driver_instance

if ocr is None:
message = "\n----------------------------------------------------\n" \
"OCR engine is not start, please check following steps:\n"\
"1. In windows platform, you need to download OCR requirement file from " \
"https://github.com/ctripcorp/flybirds/blob/main/requirements_ml.txt\n" \
"2. run command `pip install -r requirements_ml.txt`\n" \
"3. Configure `ocrLang` option in flybirds_config.json, detail languages refer to \n" \
"https://flybirds.readthedocs.io/zh_CN/latest/BDD-UI-Testing-Flybirds.html#ocr-opencv\n" \
"----------------------------------------------------\n "
raise FlybirdsException(message)

g_Context.ocr_result = ocr.ocr(img_path, cls=True)
g_Context.image_size = Image(img_path).size
log.debug(f"[image ocr path] image size is:{g_Context.image_size}")
Expand Down

0 comments on commit 936d935

Please sign in to comment.