How to use iGestureScreen method in fMBT

Best Python code snippet using fMBT_python

eyenfinger.py

Source:eyenfinger.py Github

copy

Full Screen

...881 dryRun = _g_defaultClickDryRun882 if not dryRun:883 # use xte from the xautomation package884 _runcmd("xte 'mousemove %s %s' %s" % (clickX, clickY, params))885def iGestureScreen(listOfCoordinates, duration=0.5, holdBeforeGesture=0.0, holdAfterGesture=0.0, intermediatePoints=0, capture=None, dryRun=None):886 """887 DEPRECATED - use fmbtx11.Screen.drag instead.888 Synthesizes a gesture on the screen.889 Parameters:890 listOfCoordinates891 The coordinates through which the cursor moves.892 Integer values are screen coordinates. Floating893 point values from 0.0 to 1.0 are scaled to screen894 coordinates: (0.5, 0.5) is the middle of the895 screen, and (1.0, 1.0) the bottom-right corner of896 the screen.897 duration gesture time in seconds, excluding898 holdBeforeGesture and holdAfterGesture times.899 holdBeforeGesture900 time in seconds to keep mouse down before the901 gesture.902 holdAfterGesture903 time in seconds to keep mouse down after the904 gesture.905 intermediatePoints906 the number of intermediate points to be added907 between each of the coordinates. Intermediate908 points are added to straight lines between start909 and end points.910 capture name of file where the last screenshot with911 the points through which the cursors passes is912 saved. The default is None (nothing is saved).913 dryRun if True, does not synthesize events. Still914 illustrates the coordinates through which the cursor915 goes.916 """917 _DEPRECATED()918 # The params list to be fed to xte919 params = []920 # The list of coordinates through which the cursor has to go921 goThroughCoordinates = []922 for pos in xrange(len(listOfCoordinates)):923 x, y = _coordsToInt(listOfCoordinates[pos])924 goThroughCoordinates.append((x,y))925 if pos == len(listOfCoordinates) - 1:926 break # last coordinate added927 nextX, nextY = _coordsToInt(listOfCoordinates[pos+1])928 (x,y), (nextX, nextY) = (x, y), (nextX, nextY)929 for ip in range(intermediatePoints):930 goThroughCoordinates.append(931 (int(round(x + (nextX-x)*(ip+1)/float(intermediatePoints+1))),932 int(round(y + (nextY-y)*(ip+1)/float(intermediatePoints+1)))))933 # Calculate the time (in micro seconds) to sleep between moves.934 if len(goThroughCoordinates) > 1:935 moveDelay = 1000000 * float(duration) / (len(goThroughCoordinates)-1)936 else:937 moveDelay = 0938 if not dryRun:939 # Build the params list.940 params.append("'mousemove %d %d'" % goThroughCoordinates[0])941 params.append("'mousedown 1 '")942 if holdBeforeGesture > 0:943 params.append("'usleep %d'" % (holdBeforeGesture * 1000000,))944 for i in xrange(1, len(goThroughCoordinates)):945 params.append("'usleep %d'" % (moveDelay,))946 params.append("'mousemove %d %d'" % goThroughCoordinates[i])947 if holdAfterGesture > 0:948 params.append("'usleep %d'" % (holdAfterGesture * 1000000,))949 params.append("'mouseup 1'")950 # Perform the gesture951 _runcmd("xte %s" % (" ".join(params),))952 if capture:953 intCoordinates = [ _coordsToInt(point) for point in listOfCoordinates ]954 drawLines(_g_origImage, capture, intCoordinates, goThroughCoordinates)955 return goThroughCoordinates956def iGestureWindow(listOfCoordinates, duration=0.5, holdBeforeGesture=0.0, holdAfterGesture=0.0, intermediatePoints=0, capture=None, dryRun=None):957 """958 DEPRECATED - use fmbtx11.Screen.drag instead.959 Synthesizes a gesture on the window.960 Parameters:961 listOfCoordinates962 The coordinates through which the cursor moves.963 Integer values are window coordinates. Floating964 point values from 0.0 to 1.0 are scaled to window965 coordinates: (0.5, 0.5) is the middle of the966 window, and (1.0, 1.0) the bottom-right corner of967 the window.968 duration gesture time in seconds, excluding969 holdBeforeGesture and holdAfterGesture times.970 holdBeforeGesture971 time in seconds to keep mouse down before the972 gesture.973 holdAfterGesture974 time in seconds to keep mouse down after the975 gesture.976 intermediatePoints977 the number of intermediate points to be added978 between each of the coordinates. Intermediate979 points are added to straight lines between start980 and end points.981 capture name of file where the last screenshot with982 the points through which the cursors passes is983 saved. The default is None (nothing is saved).984 dryRun if True, does not synthesize events. Still985 illustrates the coordinates through which the cursor986 goes.987 """988 screenCoordinates = [ _windowToScreen(*_coordsToInt((x,y),windowSize())) for (x,y) in listOfCoordinates ]989 return iGestureScreen(screenCoordinates, duration, holdBeforeGesture, holdAfterGesture, intermediatePoints, capture, dryRun)990def iType(word, delay=0.0):991 """992 DEPRECATED - use fmbtx11.Screen.type instead.993 Send keypress events.994 Parameters:995 word is either996 - a string containing letters and numbers.997 Each letter/number is using press and release events.998 - a list that contains999 - keys: each key is sent using press and release events.1000 - (key, event)-pairs: the event (either "press" or "release")1001 is sent.1002 - (key1, key2, ..., keyn)-tuples. 2n events is sent:1003 key1 press, key2 press, ..., keyn press,...

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