Best Python code snippet using fMBT_python
fmbtgti.py
Source:fmbtgti.py  
...1722                    foundBitmaps.append(bitmap)1723            return foundBitmaps != []1724        self.wait(self.refreshScreenshot, observe, **waitArgs)1725        return foundBitmaps1726    def waitAnyOcrText(self, listOfTexts, **waitAndOcrArgs):1727        """1728        Wait until OCR recognizes any of texts on the screen.1729        Parameters:1730          listOfTexts (list of string):1731                  texts to be waited for.1732          waitTime, pollDelay (float, optional):1733                  refer to wait documentation.1734          OCR engine specific arguments1735                  refer to help(obj.ocrEngine())1736        Returns list of texts that appeared in the first screenshot1737        that contains at least one of the texts. If none of the texts1738        appear within the time limit, returns empty list.1739        If any of texts is not found from most recently refreshed1740        screenshot, waitAnyOcrText updates the screenshot.1741        """1742        if listOfTexts == []: return []1743        if not self._lastScreenshot: self.refreshScreenshot()1744        waitArgs, rest = _takeWaitArgs(waitAndOcrArgs)1745        ocrArgs, _ = _takeOcrArgs(self._lastScreenshot, rest, thatsAll=True)1746        foundTexts = []1747        def observe():1748            for text in listOfTexts:1749                if self.verifyOcrText(text, **ocrArgs):1750                    foundTexts.append(text)1751            return foundTexts != []1752        self.wait(self.refreshScreenshot, observe, **waitArgs)1753        return foundTexts1754    def waitBitmap(self, bitmap, **waitAndOirArgs):1755        """1756        Wait until bitmap appears on screen.1757        Parameters:1758          bitmap (string):1759                  filename of the bitmap to be waited for.1760          optical image recognition arguments (optional)1761                  refer to help(obj.oirEngine()).1762          waitTime, pollDelay (float, optional):1763                  refer to wait documentation.1764        Returns True if bitmap appeared within given time limit,1765        otherwise False.1766        If the bitmap is not found from most recently refreshed1767        screenshot, waitBitmap updates the screenshot.1768        """1769        return self.waitAnyBitmap([bitmap], **waitAndOirArgs) != []1770    def waitOcrText(self, text, **waitAndOcrArgs):1771        """1772        Wait until OCR detects text on the screen.1773        Parameters:1774          text (string):1775                  text to be waited for.1776          waitTime, pollDelay (float, optional):1777                  refer to wait documentation.1778          OCR engine specific arguments1779                  refer to help(obj.ocrEngine())1780        Returns True if the text appeared within given time limit,1781        otherwise False.1782        If the text is not found from most recently refreshed1783        screenshot, waitOcrText updates the screenshot.1784        """1785        return self.waitAnyOcrText([text], **waitAndOcrArgs) != []1786class Screenshot(object):1787    """1788    Screenshot class takes and holds a screenshot (bitmap) of device1789    display, or a forced bitmap file if device connection is not given.1790    """1791    def __init__(self, screenshotFile=None, paths=None,1792                 ocrEngine=None, oirEngine=None, screenshotRefCount=None):1793        self._filename = screenshotFile1794        self._ocrEngine = ocrEngine1795        self._ocrEngineNotified = False1796        self._oirEngine = oirEngine1797        self._oirEngineNotified = False1798        self._screenshotRefCount = screenshotRefCount1799        if (type(self._screenshotRefCount) == dict and self._filename):...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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
