UNPKG

wdio-ocr-service

Version:

A WebdriverIO service that is using Tesseract OCR for Appium Native App tests.

129 lines (128 loc) 7.92 kB
export const TESSERACT_NODEJS = { jobId: 'Job-4-b61ec', data: { text: 'Username\n\nPassword\n\n \n\n \n\nLOGIN\n\n \n\n \n', hocr: '<div class=\'ocr_page\' id=\'page_1\' title=\'image ""; bbox 0 0 828 1792; ppageno 0\'>\n' + ' <div class=\'ocr_carea\' id=\'block_1_1\' title="bbox 83 326 248 352">\n' + ' <p class=\'ocr_par\' id=\'par_1_1\' lang=\'eng\' title="bbox 83 326 248 352">\n' + ' <span class=\'ocr_line\' id=\'line_1_1\' title="bbox 83 326 248 352; baseline 0 0; x_size 31.358974; ' + 'x_descenders 5.3589745; x_ascenders 7">\n' + " <span class='ocrx_word' id='word_1_1' title='bbox 83 326 248 352; x_wconf 90'>Username</span>\n" + ' </span>\n' + ' </p>\n' + ' </div>\n' + ' <div class=\'ocr_carea\' id=\'block_1_2\' title="bbox 83 454 237 480">\n' + ' <p class=\'ocr_par\' id=\'par_1_2\' lang=\'eng\' title="bbox 83 454 237 480">\n' + ' <span class=\'ocr_line\' id=\'line_1_2\' title="bbox 83 454 237 480; baseline 0 -1; x_size 30.358974; ' + 'x_descenders 5.3589745; x_ascenders 6">\n' + " <span class='ocrx_word' id='word_1_2' title='bbox 83 454 237 480; x_wconf 91'>Password</span>\n" + ' </span>\n' + ' </p>\n' + ' </div>\n' + ' <div class=\'ocr_carea\' id=\'block_1_3\' title="bbox 80 631 748 637">\n' + ' <p class=\'ocr_par\' id=\'par_1_3\' lang=\'eng\' title="bbox 80 631 748 637">\n' + ' <span class=\'ocr_line\' id=\'line_1_3\' title="bbox 80 631 748 637; baseline 0 0; x_size 3; ' + 'x_descenders -1.5; x_ascenders 1.5">\n' + " <span class='ocrx_word' id='word_1_3' title='bbox 80 631 748 637; x_wconf 95'> </span>\n" + ' </span>\n' + ' </p>\n' + ' </div>\n' + ' <div class=\'ocr_carea\' id=\'block_1_4\' title="bbox 80 631 86 733">\n' + ' <p class=\'ocr_par\' id=\'par_1_4\' lang=\'eng\' title="bbox 80 631 86 733">\n' + ' <span class=\'ocr_line\' id=\'line_1_4\' title="bbox 80 631 86 733; baseline 0 0; x_size 51; ' + 'x_descenders -25.5; x_ascenders 25.5">\n' + " <span class='ocrx_word' id='word_1_4' title='bbox 80 631 86 733; x_wconf 95'> </span>\n" + ' </span>\n' + ' </p>\n' + ' </div>\n' + ' <div class=\'ocr_carea\' id=\'block_1_5\' title="bbox 359 669 467 695">\n' + ' <p class=\'ocr_par\' id=\'par_1_5\' lang=\'eng\' title="bbox 359 669 467 695">\n' + ' <span class=\'ocr_line\' id=\'line_1_5\' title="bbox 359 669 467 695; baseline 0 0; x_size 35.333332; ' + 'x_descenders 8.833333; x_ascenders 8.833333">\n' + " <span class='ocrx_word' id='word_1_5' title='bbox 359 669 467 695; x_wconf 90'>LOGIN</span>\n" + ' </span>\n' + ' </p>\n' + ' </div>\n' + ' <div class=\'ocr_carea\' id=\'block_1_6\' title="bbox 80 727 748 733">\n' + ' <p class=\'ocr_par\' id=\'par_1_6\' lang=\'eng\' title="bbox 80 727 748 733">\n' + ' <span class=\'ocr_line\' id=\'line_1_6\' title="bbox 80 727 748 733; baseline 0 0; x_size 3; ' + 'x_descenders -1.5; x_ascenders 1.5">\n' + " <span class='ocrx_word' id='word_1_6' title='bbox 80 727 748 733; x_wconf 95'> </span>\n" + ' </span>\n' + ' </p>\n' + ' </div>\n' + ' <div class=\'ocr_carea\' id=\'block_1_7\' title="bbox 741 631 748 733">\n' + ' <p class=\'ocr_par\' id=\'par_1_7\' lang=\'eng\' title="bbox 741 631 748 733">\n' + ' <span class=\'ocr_line\' id=\'line_1_7\' title="bbox 741 631 748 733; baseline 0 0; x_size 51; ' + 'x_descenders -25.5; x_ascenders 25.5">\n' + " <span class='ocrx_word' id='word_1_7' title='bbox 741 631 748 733; x_wconf 95'> </span>\n" + ' </span>\n' + ' </p>\n' + ' </div>\n' + '</div>\n', } } export const TESSERACT_SYSTEM = '<?xml version="1.0" encoding="UTF-8"?>\n' + '<alto xmlns="http://www.loc.gov/standards/alto/ns-v3#" xmlns:xlink="http://www.w3.org/1999/xlink" ' + 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' + 'xsi:schemaLocation="http://www.loc.gov/standards/alto/ns-v3# http://www.loc.gov/alto/v3/alto-3-0.xsd">\n' + ' <Description>\n' + ' <MeasurementUnit>pixel</MeasurementUnit>\n' + ' <sourceImageInformation>\n' + ' <fileName></fileName>\n' + ' </sourceImageInformation>\n' + ' <OCRProcessing ID="OCR_0">\n' + ' <ocrProcessingStep>\n' + ' <processingSoftware>\n' + ' <softwareName>tesseract 4.1.1</softwareName>\n' + ' </processingSoftware>\n' + ' </ocrProcessingStep>\n' + ' </OCRProcessing>\n' + ' </Description>\n' + ' <Layout>\n' + ' <Page WIDTH="828" HEIGHT="1792" PHYSICAL_IMG_NR="0" ID="page_0">\n' + ' <PrintSpace HPOS="0" VPOS="0" WIDTH="828" HEIGHT="1792">\n' + ' <ComposedBlock ID="cblock_0" HPOS="83" VPOS="326" WIDTH="165" HEIGHT="26">\n' + ' <TextBlock ID="block_0" HPOS="83" VPOS="326" WIDTH="165" HEIGHT="26">\n' + ' <TextLine ID="line_0" HPOS="83" VPOS="326" WIDTH="165" ' + 'HEIGHT="26">\n' + ' <String ID="string_0" HPOS="83" VPOS="326" WIDTH="165" ' + 'HEIGHT="26" WC="0.96" CONTENT="Username"/>\n' + ' </TextLine>\n' + ' </TextBlock>\n' + ' </ComposedBlock>\n' + ' <ComposedBlock ID="cblock_1" HPOS="83" VPOS="454" WIDTH="154" HEIGHT="26">\n' + ' <TextBlock ID="block_1" HPOS="83" VPOS="454" WIDTH="154" HEIGHT="26">\n' + ' <TextLine ID="line_1" HPOS="83" VPOS="454" WIDTH="154" ' + 'HEIGHT="26">\n' + ' <String ID="string_1" HPOS="83" VPOS="454" WIDTH="154" ' + 'HEIGHT="26" WC="0.96" CONTENT="Password"/>\n' + ' </TextLine>\n' + ' </TextBlock>\n' + ' </ComposedBlock>\n' + ' <ComposedBlock ID="cblock_2" HPOS="359" VPOS="669" WIDTH="108" HEIGHT="26">\n' + ' <TextBlock ID="block_2" HPOS="359" VPOS="669" WIDTH="108" HEIGHT="26">\n' + ' <TextLine ID="line_2" HPOS="359" VPOS="669" WIDTH="108" ' + 'HEIGHT="26">\n' + ' <String ID="string_2" HPOS="359" VPOS="669" WIDTH="108" ' + 'HEIGHT="26" WC="0.95" CONTENT="LOGIN"/>\n' + ' <String ID="string_3" HPOS="360" VPOS="670" WIDTH="110" ' + 'HEIGHT="27" WC="0" CONTENT=""/>\n' + ' </TextLine>\n' + ' <TextLine ID="line_2" HPOS="359" VPOS="669" WIDTH="108" ' + 'HEIGHT="26">\n' + ' <String ID="string_3" HPOS="360" VPOS="670" WIDTH="110" ' + 'HEIGHT="27" WC="0" CONTENT=""/>\n' + ' </TextLine>\n' + ' </TextBlock>\n' + ' </ComposedBlock>\n' + ' </PrintSpace>\n' + ' </Page>\n' + 'Username\n' + '\n' + 'Password\n' + '\n' + 'LOGIN\n' + '\n' + ' </Layout>\n' + '</alto>'