Best Python code snippet using fMBT_python
fmbtx11.py
Source:fmbtx11.py
...322 Example: list window id's and names:323 for props in screen.windowList():324 print props["window"], props["name"]325 """326 return self.existingConnection().recvChildWindows(recursive=True)327class X11Connection(fmbtx11_conn.Display):328 def __init__(self, display):329 fmbtx11_conn.Display.__init__(self, display)330 def target(self):331 return "X11"332 def recvAtspiViewData(self, window):333 return fmbtx11_conn.atspiViewData(window)334 def recvScreenshot(self, filename):335 # This is a hack to get this stack quickly testable,336 # let's replace this with Xlib/libMagick functions, too...337 data = fmbtx11_conn.Display.recvScreenshot(self, "PNG")338 if data:339 if data.startswith("FMBTRAWX11"):340 try:...
fmbtx11_conn.py
Source:fmbtx11_conn.py
...274 ctypes.byref(nchildren))275 if children:276 libX11.XFree(children)277 return int(parent.value)278 def recvChildWindows(self, window=None, recursive=True, parentBbox=None):279 if window == None:280 window = self._root_window281 if parentBbox == None:282 parentBbox = self.recvWindowBbox(window)283 root = ctypes.c_uint32(0)284 parent = ctypes.c_uint32(0)285 children = ctypes.POINTER(ctypes.c_uint32)()286 nchildren = ctypes.c_int(0)287 libX11.XQueryTree(self._display,288 window,289 ctypes.byref(root),290 ctypes.byref(parent),291 ctypes.byref(children),292 ctypes.byref(nchildren))293 windows = []294 window_name = ctypes.c_char_p()295 for c in xrange(nchildren.value):296 if ctypes.sizeof(ctypes.c_void_p) == 4: # 32-bit297 child = int(children[c])298 else: # 64-bit299 child = int(children[c*2])300 libX11.XFetchName(self._display, child, ctypes.byref(window_name))301 if window_name:302 name = window_name303 else:304 name = None305 bbox = self.recvWindowBbox(child, parentBbox=parentBbox)306 window_dict = {307 "window": child,308 "parent": int(parent.value),309 "name": window_name.value,310 "bbox": bbox,311 }312 windows.append(window_dict)313 libX11.XFree(window_name)314 if recursive:315 windows.extend(self.recvChildWindows(child, True, parentBbox=bbox))316 libX11.XFree(children)317 return windows318 def recvScreenshot(self, fmt="FMBTRAWX11"):319 image_p = libX11.XGetImage(self._display, self._root_window,320 0, 0, self._width, self._height,321 _X_AllPlanes, _X_ZPixmap)322 image = image_p[0]323 if fmt.upper() == "FMBTRAWX11" or fmbtpng == None:324 # FMBTRAWX11 image format header:325 # FMBTRAWX11 [width] [height] [color depth] [bits per pixel]<linefeed>326 # Binary data327 rawfmbt_header = "FMBTRAWX11 %d %d %d %d\n" % (328 image.width, image.height, self._depth, image.bits_per_pixel)329 rawfmbt_data = ctypes.string_at(image.data, image.height * image.bytes_per_line)...
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!!