Updated the sample files
This commit is contained in:
parent
062105ede4
commit
92c2f6fcb6
@ -15,12 +15,25 @@ from pywinauto.application import Application
|
||||
# start the application and wait for the Agent Dialog to be ready
|
||||
app = Application().start_(r"c:\program files\agent\agent.exe")
|
||||
|
||||
while not app.Windows_():
|
||||
time.sleep(.5)
|
||||
|
||||
# if the trial nag dialog pops up
|
||||
if app.window_(title = "Forte Agent Trial").Exists():
|
||||
#app.ForteAgentTrial.IdLikeToContinueUsingAgentfor7moredays.Click()
|
||||
app.ForteAgentTrial.IdliketouseFreeAgent
|
||||
app.ForteAgentTrial.OK.Click()
|
||||
|
||||
if app.window_(title = "Free Agent Registration").Exists():
|
||||
app.FreeAgentRegistration.ImreallybusyRemindmein30.Click()
|
||||
app.FreeAgentRegistration.OK.CloseClick()
|
||||
|
||||
if app.window_(title = "What's New Reminder").Exists():
|
||||
app.WhatsNewReminder.ImreallybusyRemindmein90.Click()
|
||||
app.WhatsNewReminder.OK.CloseClick()
|
||||
|
||||
|
||||
|
||||
# wait until the app is ready
|
||||
app.FreeAgent.Wait("ready")
|
||||
|
||||
|
@ -48,14 +48,14 @@ def TestExceptions():
|
||||
except application.AppStartError:
|
||||
pass
|
||||
|
||||
# try when it isn't connected
|
||||
try:
|
||||
app = application.Application()
|
||||
#app.start_(ur"c:\windows\system32\notepad.exe")
|
||||
app.Notepad.Click()
|
||||
assert False
|
||||
except application.AppNotConnected:
|
||||
pass
|
||||
# # try when it isn't connected
|
||||
# try:
|
||||
# app = application.Application()
|
||||
# #app.start_(ur"c:\windows\system32\notepad.exe")
|
||||
# app.Notepad.Click()
|
||||
# #assert False
|
||||
# except application.AppNotConnected:
|
||||
# pass
|
||||
|
||||
|
||||
|
||||
|
@ -3,6 +3,8 @@ import sys
|
||||
import time
|
||||
import os.path
|
||||
|
||||
from pywinauto import WindowAmbiguousError
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print "please specify a web address to download"
|
||||
sys.exit()
|
||||
@ -53,9 +55,14 @@ app.SaveAs.FileNameEdit.SetEditText(outputfilename)
|
||||
|
||||
app.SaveAs.Save.CloseClick()
|
||||
|
||||
# if asked to overwrite say yes
|
||||
if app.SaveAs.Yes.Exists():
|
||||
try:
|
||||
# if asked to overwrite say yes
|
||||
if app.SaveAs.Yes.Exists():
|
||||
app.SaveAs.Yes.CloseClick()
|
||||
except WindowAmbiguousError, e:
|
||||
for w in e.windows:
|
||||
w = HwndWrapper(w)
|
||||
print w.WindowText(), w.Class()
|
||||
|
||||
print "saved:", outputfilename
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
"""Automate WinRAR evaluation copy
|
||||
|
||||
We hit a few dialogs and save XML dump and
|
||||
|
@ -28,7 +28,11 @@ from pywinauto import application
|
||||
from pywinauto import tests
|
||||
from pywinauto.findbestmatch import MatchError
|
||||
from pywinauto import findwindows
|
||||
from pywinauto import WindowAmbiguousError
|
||||
from pywinauto.controls import WrapHandle
|
||||
|
||||
from pywinauto.timings import Timings
|
||||
Timings.Fast()
|
||||
|
||||
app = application.Application()
|
||||
|
||||
@ -54,8 +58,17 @@ app.Attributes.Edit2.SetEditText("350") # SetText - they work differently!
|
||||
|
||||
app.Attributes.OK.CloseClick()
|
||||
|
||||
# get the reference to the Canvas window
|
||||
canvas = pwin.Afx100000008
|
||||
try:
|
||||
# get the reference to the Canvas window
|
||||
canvas = pwin.Afx100000008
|
||||
canvas.WrapperObject()
|
||||
except WindowAmbiguousError, e:
|
||||
print e, e.windows
|
||||
for w in e.windows:
|
||||
w = WrapHandle(w)
|
||||
print w.WindowText(), w.Class()
|
||||
import sys
|
||||
sys.exit()
|
||||
|
||||
# make sure the pencil tool is selected
|
||||
pwin.Tools2.Click(coords = (91, 16))
|
||||
|
@ -30,14 +30,14 @@ from pywinauto.findbestmatch import MatchError
|
||||
from pywinauto import findwindows
|
||||
|
||||
|
||||
application.set_timing(3, .5, 10, .5, .4, .2, .2, .1, .2, .5)
|
||||
#application.set_timing(3, .5, 10, .5, .4, .2, .2, .1, .2, .5)
|
||||
|
||||
"Run a quick test on Notepad"
|
||||
|
||||
app = application.Application()
|
||||
app.start_(ur"notepad.exe")
|
||||
|
||||
app['Notepad'].WaitReady()
|
||||
app['Notepad'].Wait('ready')
|
||||
|
||||
app['Notepad'].MenuSelect("File->PageSetup")
|
||||
|
||||
|
@ -37,10 +37,13 @@ except ImportError:
|
||||
from pywinauto import tests
|
||||
from pywinauto.findbestmatch import MatchError
|
||||
from pywinauto import findwindows
|
||||
from pywinauto.timings import Timings
|
||||
|
||||
print "Setting timings to slow settings, may be necessary for"
|
||||
print "slow applications or slow machines."
|
||||
application.set_timing(3, .5, 10, .5, .4, .2, .2, .1, .2, .5)
|
||||
Timings.Slow()
|
||||
|
||||
#application.set_timing(3, .5, 10, .5, .4, .2, .2, .1, .2, .5)
|
||||
|
||||
|
||||
start = time.time()
|
||||
@ -202,7 +205,7 @@ app.SaveAs.Save.CloseClick()
|
||||
|
||||
# while the dialog exists wait upto 30 seconds (and yes it can
|
||||
# take that long on my computer sometimes :-( )
|
||||
app.SaveAs.Cancel.WaitNot('enabled')
|
||||
app.SaveAsDialog2.Cancel.WaitNot('enabled')
|
||||
|
||||
try:
|
||||
app.SaveAs2.Yes.CloseClick()
|
||||
|
Loading…
Reference in New Issue
Block a user