Can a SilkTest script convert a string to window?
This can be done with the reference operator (@).
For example if you have a window " CustomerInformation " with a pushbutton " Clear " you wish to reference using a string ;
[-] window MainWin CustomerInformation [ ] [-] PushButton Clear [ ] [ ] tag "FakeButton" [-] testcase Test1() appstate none [ ] [ ] string sMain = "CustomerInformation" [ ] String sButton = "Clear" [ ] [ ] @(sMain).@(sButton).Click()
The drawback however with this is that you cannot have a " . " as part of the string as this will result in an error. This is because it will try to convert the entire string into one window whereas the " . " should separate it into two. The following will not work.
[ ]string FullWindow = "CustomerInformation.Clear" [ ] [ ] @(FullWindow).Click()