Generic way to locate an XBAP in IE
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2010
06:22 PM
08-01-2010
06:22 PM
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.
FindXBAPWindow()
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.
7 REPLIES 7
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2010
06:24 PM
08-01-2010
06:24 PM
PS - I am not sure how so many images got uploaded. Just to tell everybody that they are all identical.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2010
02:30 AM
08-02-2010
02:30 AM
Hi,
You can use the Find method to do this (see the "Find Method" help topic).
You can use the Find method to do this (see the "Find Method" help topic).
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2010
03:33 AM
08-02-2010
03:33 AM
Hi, I tried
Page1 = IE.Find("Page1");
but it didn't help. Any idea what was wrong?
Page1 = IE.Find("Page1");
but it didn't help. Any idea what was wrong?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2010
05:35 AM
08-02-2010
05:35 AM
Hi,
You're using Find incorrectly. Its first parameter is the property name by which it will search for an object, and the second parameter is the value of this property. You can find information on Find's parameters in the "Find Method" help topic.
You're using Find incorrectly. Its first parameter is the property name by which it will search for an object, and the second parameter is the value of this property. You can find information on Find's parameters in the "Find Method" help topic.
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2010
04:52 PM
08-02-2010
04:52 PM
You are right - I posted it wrongly. The way I am doing it as below:
var IE,Page1;
var PropArray = new Array("WndClass");
var ValuesArray = new Array("Page1");
// Searches for the window
IE = Sys.Process("iexplore");
Page1 = IE.Find(PropArray,ValuesArray,100)
here 'Page1' is the name of the class as well as the value set to the 'Title' property of the page in xaml.
Basically all I need is to derive WPFObject("Page1","",1) from Process("iexplore") (as per the attached object hierarchy).
var IE,Page1;
var PropArray = new Array("WndClass");
var ValuesArray = new Array("Page1");
// Searches for the window
IE = Sys.Process("iexplore");
Page1 = IE.Find(PropArray,ValuesArray,100)
here 'Page1' is the name of the class as well as the value set to the 'Title' property of the page in xaml.
Basically all I need is to derive WPFObject("Page1","",1) from Process("iexplore") (as per the attached object hierarchy).
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2010
08:08 PM
08-02-2010
08:08 PM
Hi,
First of all, since you're using a single property, there's no need to pass it in an array. You can use strings. Second, try ClrClassName instead of WndClass.
First of all, since you're using a single property, there's no need to pass it in an array. You can use strings. Second, try ClrClassName instead of WndClass.
var page = IE.Find("ClrClassName", "Page1", 100);
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2010
07:55 PM
08-03-2010
07:55 PM
That solves my problem pretty well. Thanks!
