wdio-ocr-service
Version:
A WebdriverIO service that is using Tesseract OCR for Appium Native App tests.
19 lines (15 loc) • 500 B
text/typescript
import ocrGetData from '../utils/ocrGetData'
import { Rectangles, ScreenSize } from '../typings/types'
interface OcrGetTextOptions {
androidRectangles?:Rectangles;
iOSRectangles?:Rectangles;
isTesseractAvailable: boolean;
language: string;
ocrImagesPath: string;
reuseOcr: boolean;
screenSize: ScreenSize;
}
export default async function ocrGetText(options: OcrGetTextOptions): Promise<string> {
const { text } = await ocrGetData(options)
return text.replace(/\n\s*\n/g, '\n')
}