The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:




Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> Micro Focus/Borland/Segue SilkTest

Pages: 1
Nasser Zagha
Unregistered




Identifying Windows with the same caption
      #1 - 06/30/99 01:23 PM

How do I identify multiple windows with the same caption?
I'm running an application under the browser and I have multiple windows with no caption (Netscape only).


Post Extras: Print Post   Remind Me!   Notify Moderator  
Amjad Alhait
Unregistered




Re: Identifying Windows with the same caption
      #2 - 06/30/99 01:24 PM

You can identify each window uniquely given that each window has at least a unique component.
For example: One window may have a button with the tag ''Save As'' and another with the tag ''Save''. To uniquely identify these windows, you need to modify the tag manually to point to the unique component.
In this case: Window 1 will have the tag of ''[BrowserChild]#1/[Button]Save As/..''. Window 2 will have the tag of ''''[BrowserChild]#1/[Button]Save/..''. The ''/..'' at the end brings control back to the window level. So this solution enables Silk to look at the components of each window when identifying them.
Please refer to page 64 of the Silk 1.0 User's Guide for more info.



Post Extras: Print Post   Remind Me!   Notify Moderator  
Nasser Zagha
Unregistered




Re: Identifying Windows with the same caption
      #3 - 06/30/99 01:24 PM

What about if I have two identical dialog boxes, and the only thing that different about them is that one got a Custom Win inside it
Example :
[-] window DialogBox SomeName
[ ] tag ''test''
[ ] parent SomeparentWindow
[-] PushButton OK
[-] multitag ''OK''
[ ] ''$2''
[-] CustomWin ThereMustBeAtLeastOneName
[-] msw multitag ''[MSOUNISTAT]Some text goes here''
[ ] ''[MSOUNISTAT]$-1''

I have tried the following but unfortinitly it didn't work:

tag ''[DialogBox]test/[CustomWin]Some text goes here/..''
and I have tried this one too;
tag ''[DialogBox]test/[CustomWin][[MSOUNISTAT]]Some text goes here/..''

and neither one of them worked.

Note: By the way, thanks for your previous reply.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Clayton Colwell
Unregistered




Re: Identifying Windows with the same caption
      #4 - 06/30/99 01:25 PM

> tag ''[DialogBox]test/[CustomWin]Some text goes here/..''
>
Have you tried

tag ''[DialogBox]test/[CustomWin]#1/..''

?

If your window has only one CustomWin element in it, I would
think the tag I give *should* be recognized. You might have
trouble recognizing the window *without* the CustomWin
element, though.
You might try

tag GetFunkyWinTag ()

combined with a subroutine:

STRING GetFunkyWinTag ()
if SomeName.CustomWin(''#1'').Exists ()
return ''[DialogBox]test/[CustomWin]#1/..''
else
return ''[DialogBox]test''

as an alternative. Others will probably have more elegant solutions,
though.
--
Clayton Colwell
Software Tester/Developer
Motorola, Austin



Post Extras: Print Post   Remind Me!   Notify Moderator  
AJBachman
Member


Reged: 12/17/99
Posts: 53
Loc: Rochester, NY, USA
Re: Identifying Windows with the same caption
      #5 - 12/17/99 09:40 AM

The problem related to the tag not working (which is almost correct) is that for CustomWin's you do not use [CustomWin] as is done with other objects in the tag. So "/[MSOUNISTAT]Some text goes here" would identify that child window.

The tag should like this:
tag "[DialogBox]test/[MSOUNISTAT]Some text goes here/.."


------------------
Andy Bachman


Post Extras: Print Post   Remind Me!   Notify Moderator  
wwaat
Member


Reged: 04/06/01
Posts: 32
Loc: Akron, Ohio, USA
Re: Identifying Windows with the same caption
      #6 - 04/12/01 08:31 AM

User Bill Watkins (wwaat@yahoo.com) posted:


Hello all

I am having trouble remebering the syntax for the tag statement that allows you differentiate between multiple window with the same caption using a unique object on the page.



ie

window BrowserPage Login

tag "My Sample Tag"

window BrowserPage AccountSummary

tag "My Sample Tag"



How can i if for instance that I have a HtmlTextField on the Login page distinguish based on that field that it is the login page.



TYIA



Bill Watkins
Bill Watkins

Quality Assurance Engineer
---------------------------------


Post Extras: Print Post   Remind Me!   Notify Moderator  
ademin
Member


Reged: 01/21/00
Posts: 131
Loc: Chicago, Illinois, USA
Re: Identifying Windows with the same caption
      #7 - 04/12/01 11:37 AM

I am not sure if it helps but if you have several windows open with same name you can set a different Title for each one with "user32.dll" function.


something like this:
[ ]use "msw32.inc"
[ ]int hWnd

[-] testcase SetTitle ()
[ ]hWnd = DialogBox("Netscape")
[ ]SetWindowText(hWnd, "WinName1")
// bring next window into focus
[ ]DialogBox("Netscape").SetActive
[ ]hWnd = DialogBox("Netscape")
[ ]SetWindowText(hWnd, "WinName2")

etc...
or
while(DialogBox("Netscape").Exists())


------------------

[This message has been edited by ademin (edited 04-12-2001).]

Post Extras: Print Post   Remind Me!   Notify Moderator  
vincebowdren
Member


Reged: 08/31/99
Posts: 469
Loc: Cambridge, UK
Re: Identifying Windows with the same caption
      #8 - 04/19/01 02:08 AM

Ademin - can you explain what this function does here. Does it actually change the caption of the window? That sounds potentially very useful indeed.

------------------


Post Extras: Print Post   Remind Me!   Notify Moderator  
ademin
Member


Reged: 01/21/00
Posts: 131
Loc: Chicago, Illinois, USA
Re: Identifying Windows with the same caption
      #9 - 04/19/01 10:11 AM

I am really sorry for confusion. Instead of

[ ]hWnd = DialogBox("Netscape")

should be:

[ ]hWnd = DialogBox("Netscape").GetHandle()

Here is a qucik sample that works. I used Internet Explorer browser that defaulted to blank page.

[ ]use "msw32.inc"
[ ]int hWnd

[-] testcase SetTitle ()
[ ] //open four windows with same title
[ ] SYS_Execute ("start iexplore")
[ ] SYS_Execute ("start iexplore")
[ ] SYS_Execute ("start iexplore")
[ ] SYS_Execute ("start iexplore")
[ ]
[ ] //assign different title for each window
[ ] MainWin("about:blank*").SetActive()
[ ] hWnd = MainWin("about:blank*").GetHandle()
[ ] SetWindowText(hWnd, "TEST1")
[ ]
[ ] MainWin("about:blank*").SetActive()
[ ] hWnd = MainWin("about:blank*").GetHandle()
[ ] SetWindowText(hWnd, "TEST2")
[ ]
[ ] MainWin("about:blank*").SetActive()
[ ] hWnd = MainWin("about:blank*").GetHandle()
[ ] SetWindowText(hWnd, "TEST3")
[ ]
[ ] MainWin("about:blank*").SetActive()
[ ] hWnd = MainWin("about:blank*").GetHandle()
[ ] SetWindowText(hWnd, "TEST4")
[ ]
[ ]


[ ]
[ ]
[ ] //close each window with appropriate title
[ ] MainWin("TEST1").Close ()
[ ] MainWin("TEST2").Close ()
[ ] MainWin("TEST3").Close ()
[ ] MainWin("TEST4").Close ()

It works with Dialog boxes also.


[This message has been edited by ademin (edited 04-19-2001).]

Post Extras: Print Post   Remind Me!   Notify Moderator  
GodKnows
Member


Reged: 01/31/01
Posts: 752
Re: Identifying Windows with the same caption
      #10 - 04/23/01 11:12 AM

Where do you get the function SetWindowText().
Is it from Win32 API or from Silk?

------------------


Post Extras: Print Post   Remind Me!   Notify Moderator  
jamesa00
Junior Member


Reged: 02/05/01
Posts: 21
Loc: ottawa
Re: Identifying Windows with the same caption
      #11 - 04/24/01 12:08 AM

quote:
Originally posted by Nasser Zagha:
How do I identify multiple windows with the same caption?
I'm running an application under the browser and I have multiple windows with no caption (Netscape only).

one way and probably the best way...is to use the handle of the dialog. A stated in one of the above posts use the gethandle method to return the window handle. What I do is take a snap shot if a new dialog opens. I save these values and do comparison aganist a new dialog if one opens. I always verify the handle first as the OS generates this randomly and uniquely. So if the handle is different and the caption is the same no problem we know it is a new dialog because of the handle difference.

GodKnows: you asked if the SetWindowText() is a winAPI call...yes it is. I use alot of the window\dialog API calls in my auto engine. One knock against Silktest though is it is very hard to create API calls using silktest's syntax.

------------------


Post Extras: Print Post   Remind Me!   Notify Moderator  
Murn
Member


Reged: 02/08/01
Posts: 33
Re: Identifying Windows with the same caption
      #12 - 04/23/01 01:04 PM

ademin,

I tried your script. It does not work for me. I'm using SilkTest 5.0.3.2 and IE 5.5 that defaults to a blank page. When I run it, it does open the four browser windows but I always get the error message "*** Error: Window '[MainWin]about:blank*' is not unique"

It's occurring in the SetActive() statement - which makes sense because how would it know which browser to set active if they all named the exact same thing?
Am I doing something wrong?

------------------


Post Extras: Print Post   Remind Me!   Notify Moderator  
ademin
Member


Reged: 01/21/00
Posts: 131
Loc: Chicago, Illinois, USA
Re: Identifying Windows with the same caption
      #13 - 04/24/01 08:00 AM

quote:
Originally posted by Murn:
ademin,

I tried your script. It does not work for me. I'm using SilkTest 5.0.3.2 and IE 5.5 that defaults to a blank page. When I run it, it does open the four browser windows but I always get the error message "*** Error: Window '[MainWin]about:blank*' is not unique"

It's occurring in the SetActive() statement - which makes sense because how would it know which browser to set active if they all named the exact same thing?
Am I doing something wrong?


Sorry for not mentioning that Agent option "Verify that a tag uniquely identifies a window" should be disabled.

Or put a statement in the script
Agent.SetOption(OPT_VERIFY_UNIQUE, FALSE)

------------------


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 15 anonymous users are browsing this forum.

Moderator:  AJ, jamesso, DJGray, David Reed 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating: ***
Topic views: 3169

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5