How to use takerFree method in fMBT

Best Python code snippet using fMBT_python

fmbtwindows_agent.py

Source:fmbtwindows_agent.py Github

copy

Full Screen

...1960 # on 32-bit Python in separate threads, but did not work in 64-bit1961 # after the first thread. Pythonshare-server creates a new thread for1962 # each connection. Therefore we need a single screenshot taker thread.1963 global _g_lastWidth, _g_lastHeight1964 def takerFree(srcdc, memdc, bmp):1965 if bmp != None:1966 ctypes.windll.gdi32.DeleteObject(bmp)1967 if memdc != None:1968 ctypes.windll.gdi32.DeleteObject(memdc)1969 if srcdc != None:1970 ctypes.windll.user32.ReleaseDC(0, srcdc)1971 def takerRealloc(width, height, srcdc, memdc, bmp, c_bmp_header, c_bits):1972 takerFree(srcdc, memdc, bmp)1973 bmp_header = struct.pack('LHHHH', struct.calcsize('LHHHH'), width, height, 1, 24)1974 srcdc = ctypes.windll.user32.GetDC(0)1975 memdc = ctypes.windll.gdi32.CreateCompatibleDC(srcdc)1976 bmp = ctypes.windll.gdi32.CreateCompatibleBitmap(srcdc, width, height)1977 c_bmp_header = ctypes.c_buffer(bmp_header)1978 c_bits = ctypes.c_buffer(' ' * (height * ((width * 3 + 3) & -4)))1979 return srcdc, memdc, bmp, c_bmp_header, c_bits1980 srcdc, memdc, bmp, c_bmp_header, c_bits = (None,) * 51981 SRCCOPY = 0xCC00201982 DIB_RGB_COLORS = 01983 width, height = _g_screenshotRequestQueue.get()1984 while width != "QUIT":1985 if width == None: # try autodetect1986 left = ctypes.windll.user32.GetSystemMetrics(SM_XVIRTUALSCREEN)1987 right =ctypes.windll.user32.GetSystemMetrics(SM_CXVIRTUALSCREEN)1988 width = right - left1989 else:1990 left = 01991 if height == None:1992 top = ctypes.windll.user32.GetSystemMetrics(SM_YVIRTUALSCREEN)1993 bottom = ctypes.windll.user32.GetSystemMetrics(SM_CYVIRTUALSCREEN)1994 height = bottom - top1995 else:1996 top = 01997 if (width, height) != (_g_lastWidth, _g_lastHeight):1998 srcdc, memdc, bmp, c_bmp_header, c_bits = takerRealloc(1999 width, height, srcdc, memdc, bmp, c_bmp_header, c_bits)2000 _g_lastWidth = width2001 _g_lastHeight = height2002 ctypes.windll.gdi32.SelectObject(memdc, bmp)2003 ctypes.windll.gdi32.BitBlt(memdc, 0, 0, width, height, srcdc, left, top, SRCCOPY)2004 got_bits = ctypes.windll.gdi32.GetDIBits(2005 memdc, bmp, 0, height, c_bits, c_bmp_header, DIB_RGB_COLORS)2006 _g_screenshotResponseQueue.put((width, height, zlib.compress(c_bits.raw)))2007 width, height = _g_screenshotRequestQueue.get()2008 takerFree(srcdc, memdc, bmp)2009def wmicGet(component, componentArgs=()):2010 cmd = (["wmic", component] +2011 list(componentArgs) +2012 ["get", "/format:textvaluelist"])2013 s, o, e = shellSOE(cmd)2014 rv = {}2015 for l in o.splitlines():2016 try:2017 key, value = l.split("=", 1)2018 except ValueError:2019 continue2020 rv[key] = value2021 return rv2022if not "_mouse_input_area" in globals():...

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