Best Python code snippet using fMBT_python
fmbtandroid.py
Source:fmbtandroid.py
...1295 """1296 Returns the last view (the most recently refreshed view).1297 """1298 return self._lastView1299 def waitAnyText(self, listOfTexts, partial=False, uiautomatorDump=False, **waitKwArgs):1300 """1301 Wait until any of texts is on the screen.1302 Parameters:1303 listOfTexts (list of string):1304 texts to be waited for.1305 partial (boolean, optional):1306 refer to verifyText. The default is False.1307 uiautomatorDump (boolean, optional):1308 use uiautomator to read view dump from the device.1309 If not given, uiautomatorDump() default will be used.1310 waitTime, pollDelay, beforeRefresh, afterRefresh (optional):1311 refer to wait documentation.1312 Returns list of texts that appear in the first refreshed view1313 that contains at least one of the texts. If none of the texts1314 appear within the time limit, returns empty list.1315 If any of texts is not found from the latest refreshed1316 view, waitAnyText will update the view in pollDelay interval until1317 waitTime is exceeded.1318 """1319 if listOfTexts == []: return []1320 if not self._lastView: self.refreshView(uiautomatorDump=uiautomatorDump)1321 waitArgs, rest = fmbtgti._takeWaitArgs(waitKwArgs)1322 foundTexts = []1323 def observe():1324 for text in listOfTexts:1325 if self.verifyText(text, partial=partial):1326 foundTexts.append(text)1327 return foundTexts != []1328 self.wait(1329 lambda: self.refreshView(uiautomatorDump=uiautomatorDump),1330 observe, **waitArgs)1331 return foundTexts1332 def waitText(self, text, *waitAnyTextArgs, **waitAnyTextKwArgs):1333 """1334 Wait until text appears in any view item.1335 Parameters:1336 text (string):1337 text to be waited for.1338 partial (boolean, optional):1339 refer to verifyText. The default is False.1340 uiautomatorDump (boolean, optional):1341 use uiautomator to read view dump from the device.1342 If not given, uiautomatorDump() default will be used.1343 waitTime, pollDelay, beforeRefresh, afterRefresh (optional):1344 refer to wait documentation.1345 Returns True if text appeared within given time limit,1346 otherwise False.1347 Updates the last view if the text is not found in the latest view1348 and waitTime > 0.1349 """1350 return self.waitAnyText(1351 [text], *waitAnyTextArgs, **waitAnyTextKwArgs) != []1352 def wake(self):1353 """1354 Force the device to wake up.1355 """1356 return self.existingConnection().sendWake()1357 def _loadDeviceAndTestINIs(self, homeDir, deviceName, iniFile):1358 if deviceName != None:1359 _deviceIniFilename = homeDir + os.sep + "etc" + os.sep + deviceName + ".ini"1360 self.loadConfig(_deviceIniFilename, override=True, level="device")1361 if iniFile:1362 self.loadConfig(iniFile, override=True, level="test")1363class Ini:1364 """...
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!!