Quote:
Lot of people say it is a fine language.
Yeah, I heard good stories about it to, from very respectable programmers.
Quote:
Looks like a serious concurrent of AutoHotkey... and AutoIt!
My thought too.
Looks like your LUA idea is here, just with Python.
This is sample script from documentation:
Code:
#---------------------------------------------------------------------------------------------
# CalcTest1-de.py - Python testscript for Ranorex
#---------------------------------------------------------------------------------------------
"""CalcTest1-de.py -- demonstrates automated GUI testing of calc.exe with Ranorex
(german OS version)
Usage: CalcTest1-de [sleeptime]
sleeptime ... Integer value between 1 and 10000, indicating the interval (in milliseconds) you want the
script process to be inactive between the commands (default=500).
CalcTest1-de.py demonstrates searching of forms, finding of controls by name and
clicking of buttons
"""
__version__ = 1, 0, 0
import sys
import RanorexPython as Ranorex
TESTED_APPLICATION_PATH = 'calc.exe' # Name of the application
TESTED_APPLICATION_TITLE = 'Rechner' # Title of calc.exe in german version
def printerror(*args):
msg = ' '.join(args)
sys.stderr.write(msg)
sys.stderr.write("\n")
def main():
if len(sys.argv) > 2:
printerror("Too many arguments!\n\n" + __doc__)
return 1
sleeptime = 500
# Reading sleeptime
if len(sys.argv) == 2:
sleeptime = int(sys.argv[1])
if sleeptime < 1 or sleeptime > 10000:
printerror("Arguments error, use a value between 1 and 10000!\n\n" + __doc__)
return 2
print '---------------------------------------------------------------------'
print ' General functions'
print '---------------------------------------------------------------------'
Ranorex.SetSleepTime(sleeptime)
sleeptime = Ranorex.GetSleepTime()
print ' SleepTime=' + str(sleeptime)
Ranorex.Sleep(100)
print '---------------------------------------------------------------------'
print ' Activating Form: ' + TESTED_APPLICATION_TITLE
print '---------------------------------------------------------------------'
form = Ranorex.FormFindTitle(TESTED_APPLICATION_TITLE)
if form == 0:
print ' Form not found, starting application...' + TESTED_APPLICATION_PATH
ret=Ranorex.ApplicationStart(TESTED_APPLICATION_PATH)
if ret != 0:
print '\nERROR: Cannot start application, please start the tested application calc.exe start the script again'
return 3
print ' Activating test application...'
form=Ranorex.FormFindTitle(TESTED_APPLICATION_TITLE,Ranorex.MATCH_EXACT,1,5000)
if form == 0:
print 'Error: Form not found'
return 4
print ' Form found, form=' + hex(form)
print '--------------------------------------------------------------------'
print ' Searching and testing buttons'
print '---------------------------------------------------------------------'
print ' searching button 2 by text'
button2=Ranorex.FormFindChildText(form,'2',Ranorex.MATCH_EXACT)
if button2 == 0:
print 'ERROR: button button2 not found'
return 5
print ' button2=' + hex(button2)
if Ranorex.ButtonClick(button2) == False:
print 'ERROR: pressing button2'
return 5
print ' searching button * by text'
buttonx=Ranorex.FormFindChildText(form,'*',Ranorex.MATCH_EXACT)
if buttonx == 0:
print 'ERROR: button buttonx not found'
return 5
print ' buttonx=' + hex(buttonx)
if Ranorex.ButtonClick(buttonx) == False:
print 'ERROR: pressing buttonx'
return 5
print ' searching button 3 by text'
button3=Ranorex.FormFindChildText(form,'3',Ranorex.MATCH_EXACT)
if button3 == 0:
print 'ERROR: button button3 not found'
return 5
print ' button3=' + hex(button3)
if Ranorex.ButtonClick(button3) == False:
print 'ERROR: pressing button3'
return 5
print ' searching button = by text'
buttoni=Ranorex.FormFindChildText(form,'=',Ranorex.MATCH_EXACT)
if buttoni == 0:
print 'ERROR: button buttoni not found'
return 5
print ' buttoni=' + hex(buttoni)
if Ranorex.ButtonClick(buttoni) == False:
print 'ERROR: pressing buttoni'
return 5
print '--------------------------------------------------------------------'
print ' Closing application: ' + TESTED_APPLICATION_TITLE
print '---------------------------------------------------------------------'
Ranorex.ApplicationClose(TESTED_APPLICATION_TITLE)
Ranorex.Sleep(1000)
print 'End'
if __name__ == "__main__":
ret = main()
sys.exit(ret)