How to use wmicGet method in fMBT

Best Python code snippet using fMBT_python

fmbtwindows.py

Source:fmbtwindows.py Github

copy

Full Screen

...657 full path to the file.658 """659 escapedFilename = filepath.replace('/', '\\').replace('\\', r'\\\\')660 return self.existingConnection().evalPython(661 '''wmicGet("datafile",'''662 '''componentArgs=("where", "name='%s'"))''' %663 escapedFilename)664 def getFile(self, remoteFilename, localFilename=None, compress=False):665 """666 Fetch file from the device.667 Parameters:668 remoteFilename (string):669 file to be fetched on device670 localFilename (optional, string or None):671 file to be saved to local filesystem. If None,672 return contents of the file without saving them.673 compress (optional, boolean or integer):674 if True, file contents will be compressed for the transfer.675 Integer (0-9) defines compression level. The default is676 False: transfer without compression.677 """678 return self._conn.recvFile(remoteFilename, localFilename, compress)679 def getMatchingPaths(self, pathnamePattern):680 """681 Returns list of paths matching pathnamePattern on the device.682 Parameters:683 pathnamePattern (string):684 Pattern for matching files and directories on the device.685 Example:686 getMatchingPaths("c:/windows/*.ini")687 Implementation runs glob.glob(pathnamePattern) on remote device.688 """689 return self._conn.recvMatchingPaths(pathnamePattern)690 def getClipboard(self):691 """692 Returns clipboard contents in text format.693 See also: setClipboard()694 """695 return self.existingConnection().evalPython("getClipboardText()")696 def itemOnScreen(self, guiItem, relation="touch", topWindowBbox=None):697 """698 Returns True if bbox of guiItem is non-empty and on the screen699 Parameters:700 relation (string, optional):701 One of the following:702 - "overlap": item intersects the screen and the window.703 - "touch": mid point (the default touch point) of the item704 is within the screen and the window.705 - "within": the screen and the window includes the item.706 The default is "touch".707 """708 if guiItem.properties().get("IsOffscreen", False) == "True":709 return False710 if relation == "touch":711 x1, y1, x2, y2 = guiItem.bbox()712 if x1 == x2 or y1 == y2:713 return False # a dimension is missing => empty item714 itemBox = (guiItem.coords()[0], guiItem.coords()[1],715 guiItem.coords()[0] + 1, guiItem.coords()[1] + 1)716 partial = True717 elif relation == "overlap":718 itemBox = guiItem.bbox()719 partial = True720 elif relation == "within":721 itemBox = guiItem.bbox()722 partial = False723 else:724 raise ValueError('invalid itemOnScreen relation: "%s"' % (relation,))725 maxX, maxY = self.screenSize()726 if topWindowBbox == None:727 try:728 topWindowBbox = self.topWindowProperties()['bbox']729 except TypeError:730 topWindowBbox = (0, 0, maxX, maxY)731 return (fmbtgti._boxOnRegion(itemBox, (0, 0, maxX, maxY), partial=partial) and732 fmbtgti._boxOnRegion(itemBox, topWindowBbox, partial=partial))733 def kill(self, pid):734 """735 Terminate process736 Parameters:737 pid (integer):738 ID of the process to be terminated.739 """740 try:741 return self.existingConnection().evalPython(742 "kill(%s)" % (repr(pid),))743 except:744 return False745 def keyNames(self):746 """747 Returns list of key names recognized by pressKey748 """749 return sorted(_g_keyNames)750 def osProperties(self):751 """752 Returns OS properties as a dictionary753 """754 return self.existingConnection().evalPython(755 "wmicGet('os')")756 def pinch(self, (x, y), startDistance, endDistance,757 finger1Dir=90, finger2Dir=270, movePoints=20,758 duration=0.75):759 """760 Pinch (open or close) on coordinates (x, y).761 Parameters:762 x, y (integer):763 the central point of the gesture. Values in range764 [0.0, 1.0] are scaled to full screen width and765 height.766 startDistance, endDistance (float):767 distance from both finger tips to the central point768 of the gesture, at the start and at the end of the769 gesture. Values in range [0.0, 1.0] are scaled up to...

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