How to use _assumeOcrResults method in fMBT

Best Python code snippet using fMBT_python

fmbtgti.py

Source:fmbtgti.py Github

copy

Full Screen

...441 if ssId in self._ss:442 del self._ss[ssId]443 def _findText(self, screenshot, text, match=None, preprocess=None, area=None, pagesegmodes=None):444 ssId = id(screenshot)445 self._assumeOcrResults(screenshot, preprocess, area, pagesegmodes)446 for ppfilter in self._ss[ssId].words.keys():447 try:448 score_text_bbox_list = eyenfinger.findText(449 text, self._ss[ssId].words[ppfilter], match=match)450 if not score_text_bbox_list:451 continue452 else:453 break454 except eyenfinger.BadMatch:455 continue456 else:457 return []458 retval = [GUIItem("OCR text (match %.2f)" % (score,),459 bbox, self._ss[ssId].filename,460 ocrFind=text, ocrFound=matching_text)461 for score, matching_text, bbox in score_text_bbox_list]462 return retval463 def _dumpOcr(self, screenshot, match=None, preprocess=None, area=None, pagesegmodes=None):464 ssId = id(screenshot)465 if self._ss[ssId].words == None:466 self._assumeOcrResults(screenshot, preprocess, area, pagesegmodes)467 w = []468 for ppfilter in self._ss[ssId].preprocess:469 for word in self._ss[ssId].words[ppfilter]:470 for appearance, (wid, middle, bbox) in enumerate(self._ss[ssId].words[ppfilter][word]):471 (x1, y1, x2, y2) = bbox472 w.append((word, (x1, y1, x2, y2)))473 return sorted(set(w), key=lambda i:(i[1][1]/8, i[1][0]))474 def _assumeOcrResults(self, screenshot, preprocess, area, pagesegmodes):475 ssId = id(screenshot)476 if not type(preprocess) in (list, tuple):477 preprocess = [preprocess]478 if self._ss[ssId].words == None or self._ss[ssId].preprocess != preprocess or self._ss[ssId].area != area:479 self._ss[ssId].words = {}480 self._ss[ssId].preprocess = preprocess481 self._ss[ssId].area = area482 for ppfilter in preprocess:483 pp = ppfilter % { "zoom": "-resize %sx" % (self._ss[ssId].screenSize[0] * 2) }484 eyenfinger.iRead(source=self._ss[ssId].filename, ocr=True, preprocess=pp, ocrArea=area, ocrPageSegModes=pagesegmodes)485 self._ss[ssId].words[ppfilter] = eyenfinger._g_words486def _defaultOcrEngine():487 if _g_defaultOcrEngine:488 return _g_defaultOcrEngine...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful