How to use recvWindowBbox method in fMBT

Best Python code snippet using fMBT_python

fmbtx11_conn.py

Source:fmbtx11_conn.py Github

copy

Full Screen

...236 success = True237 for character in string:238 success = success and self.sendPress(character)239 return success240 def recvWindowBbox(self, window, parentBbox=None):241 rw = ctypes.c_uint32(0)242 x = ctypes.c_int(0)243 y = ctypes.c_int(0)244 width = ctypes.c_uint(0)245 height = ctypes.c_uint(0)246 bwidth = ctypes.c_uint(0)247 depth = ctypes.c_uint(0)248 libX11.XGetGeometry(249 self._display, window,250 ctypes.byref(rw),251 ctypes.byref(x), ctypes.byref(y),252 ctypes.byref(width), ctypes.byref(height),253 ctypes.byref(bwidth), ctypes.byref(depth))254 if parentBbox == None:255 parent = self.recvParentWindow(window)256 if parent != 0:257 parentBbox = self.recvWindowBbox(parent)258 else:259 parentBbox = (0, 0, 0, 0)260 left = int(x.value + parentBbox[0])261 top = int(y.value + parentBbox[1])262 bbox = (left, top, int(left + width.value), int(top + height.value))263 return bbox264 def recvParentWindow(self, window):265 root = ctypes.c_uint32(0)266 parent = ctypes.c_uint32(0)267 children = ctypes.POINTER(ctypes.c_uint32)()268 nchildren = ctypes.c_int(0)269 libX11.XQueryTree(self._display,270 window,271 ctypes.byref(root),272 ctypes.byref(parent),273 ctypes.byref(children),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,...

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