Forum Discussion

Angshuman's avatar
Angshuman
Occasional Contributor
14 years ago

Generic way to locate an XBAP in IE

I am looking for a generic way to locate an XBAP window (a WPF 'Page' class) within the IE window. My problem is that the WPF page might be contained directly within the IE window, or it might be nested within some other control running inside the IE window. I wish to use the same script in either cases (as I have no clue on the exact hierarchy above my XBAP page)



Please take a look at the above screenshot, where the XBAP ('Page1') is a child window inside the 'process("iexplore")' object.  However the following code to locate it doesn't work. The variable 'IE' gets populated correctly, but the next statement results in "The object with the specified attributes does not exist." error.






function FindXBAPWindow()


FindXBAPWindow()

{


var IE,Page1;


 


// Searches for the window


IE = Sys.Process("iexplore");


Page1 = IE.WPFObject("Page1","",1)


 


 


// Processes the search results


if (Page1.Exists)


Log.Message(Page1.FullName);


else


Log.Error("The object was not found.");


 


 


}



Please help me on where I am going wrong.





Thanks in advance.

No RepliesBe the first to reply