How to write code to get focuse the application which is open from server

Mark mark.m.mcmahon at gmail.com
Thu Jan 18 17:38:15 EST 2007


Hi,

There are better places to find me then on comp.lang.python (just too
much traffic for me)
pywinauto forums: http://forums.openqa.org/forum.jspa?forumID=15
or subscribe pywinauto mailing list:
https://lists.sourceforge.net/lists/listinfo/pywinauto-users


vithi wrote:
<SNIP>
> MatchError: Could not find 'Print' in '['', u'Transparent Windows
> Client0', u'Transparent Windows Client2', u'Transparent Windows
> Client1', u'Print - \\\\Remote', u'Transparent Windows Client', u'Print
> - \\\\RemoteTransparent Windows Client']'
>
> This is the code
> import sys
> import time
> import application
> app = application.Application()
> qi=app.window_(title_re = ".*ArcView.*")
> time.sleep(2)
> qi.TypeKeys("%FP")
> time.sleep(2)
>
> app.Print.Ok.CloseClick()
>
>
My guess is that problem above is that teh title of the window is
u"Print - \\Remote", and "Print"  is not enough information for
pywinauto to go on.

I suggest you replace the last line with one of the following...
    app.PrintRemote.Ok.CloseClick()
    app.window_(title_re = "Print - .*").Ok.CloseClick()

Someone also was wondering why they do not have to call
Application.Start() or Application.Connect() explicitly - that is
because the first call to app.window_() will initialize the application
appropriately.  The reason for this is that most usages ended up being
a) Connect to a window with specific title, then use that window in the
next line - so I was trying to avoid duplication.

Thanks
  Mark




More information about the Python-list mailing list