Question

Using SilkTest, I am identifying a Putty window with the following technique: Window puttyWindow = desktop.<Window>find("//Window[@caption='*PuTTY*']");

Is there a better way to accomplish this? Perhaps get an ID number to identify the Window? Or is this the best way to do it?

Était-ce utile?

La solution

For top level windows, usually the caption is the way to go. Depending on the technology of the application you are testing, there may also be better attributes available (for example the automation id in Windows Forms) but those are usually not available for the window, only the controls below.

On a side note, you can skip the type parameter if you are assigning the result to a variable of that type, like this

Window puttyWindow = desktop.find("/Window[@caption='*PuTTY*']");

Note: I work for Borland in the Silk Test team, so any opinions expressed in that regard are somewhat biased.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top