Aug 18 2009 05:26:01 PM Posted By : rajasankar
Comments (0)

If you encounter the dynamic windows in the UI automation, you can easily handle them.

Here are the functions available

Code:
setDynamicWindow(parenttitle,parentindex=1,framepropertyname="NONE",framepropertyvalue="NONE",frameindex=1)
closeDynamicWindow(parenttitle,parentindex=1)


If more than one window is present you can use parentindex and frameindex to choose which window.

However, consider this situation. You don't want to enter the title of the window or title keeps changing. What to do in this case?

We need to use the following functions to handle such cases.

Code:
getLastWindowTitle()
getWindowTitle()
getWindowURL()
getLastWindowURL()


I hope the function names are self explanatory. However, we need to use setLastWindow function once we changed the focus.

Example 1.

If the dynamic window doesn't have any inner frames.
Code:


setDynamicWindow("Test page",1,"NONE","NONE",1)

closeDynamicWindow("Test page",1)


Example 2.

If the dynamic window has any inner frames.

Code:


setDynamicWindow("Test page",1,"title","mypage",1)

closeDynamicWindow("Test page",1)


Now consider this case. Windows title is not known or can't be predicted.

Example 3.

Code:

gwt=getWindowTitle()

gwtn=getWindowTitle()
if gwt!=gwtn:
setDynamicWindow(gwtn,1,"NONE","NONE",1)

closeDynamicWindow(gwtn,1)

or

Code:


gwt=getLastWindowTitle()
gwtn=getWindowTitle()
if gwt!=gwtn:
setDynamicWindow(gwtn,1,"NONE","NONE",1)

closeDynamicWindow(gwtn,1)


You can add more conditions if needed

Example 4.

Code:


gwt=getLastWindowTitle()
gwtn=getWindowTitle()
if gwt!=gwtn and gwt!= and gwtn!=:
setDynamicWindow(gwtn,1,"NONE","NONE",1)

closeDynamicWindow(gwtn,1)


This will ensure that dynamic windows are taken care without knowing the window title.

Rajasankar
rajasankar at zohocorp dot com

No one has commented yet! Be the first one to comment!

Post Comment