can you help me to find solution for my case?
I have attached an example.
My application has 3 windows - 2 are visible, and one has Visibility = Hidden.
By WpfApplication.Windows.Count i can get 2 visible windows. But after my third window become Visible the count is still 2.
I can see two ways to pass this problem:
1) refresh WpfApplication, like WpfApplication.MainWindow.RefreshVisualTrees() but for the entire application;
2) initialize WpfApplication after my window will be Visible, i.e. connect through the processID.
The problem is that i was not able to find the way to implement any of this options.
Can you suggest something?
7 Answers, 1 is accepted
Thanks for all details provided.
I reviewed the example provided along with the information you shared. However I do not see how the provided application makes the third window visible.
Therefore I created a sample app based on the one you sent. The only difference is that a button is added to one of the visible windows which changes the visibility of the third hidden window. When recording a test against that application once the third window appears the recorder detects it and attaches to it.
Please find attached the sample application described above and give it a try. I hope it will be a good example for your query.
Telerik by Progress
Hi Elena, thank you for your example. In mine i changed parameter for window in Snoop.
Sorry if i post this in wrong forum, but i'm not using recorder, i'm using Telerik Testing Framework 2015.3.1015.
I build your application and created a small test:
public void Test()
WpfApplication app = Manager.LaunchNewApplication(@"c:\Users\aba\Downloads\WpfApplication2\WpfApplication2\bin\Debug\WpfApplication2.exe");
I have break point on Assert.IsTrue(false); and start to debug test.
In Immediate Window in Visual studio after hit break point i call:
which return me 2.
After that I click on button and i can see that Window2_test now is visible. So i call again in Immediate Window :
But it still return count - 2 for me.
It mean that i can't search elements under window 2 which is now visible.
Thank you for getting back to me.
I tested your scenario on my end and found out that the third window is not successfully detected as you reported. Therefore I submitted a bug report to our feedback portal on your behalf. Here you could find it and follow its progress, comment and vote for it.
Thank you once again for your cooperation and understanding!
Telerik by Progress
You are welcome. Please follow the progress of the issue from the previously provided link. Hopefully a fix will be soon introduced.
Telerik by Progress
Hi Elena, i got a reply on ticket and i think we confusing little bit each other.
In question on feedback portal and in answer you are using "Manager.ActiveApplication.Windows". Yes, proposed solution works with this approach. But it looks suspicious when in tests you are working with two WPF applications.
In my tests i have 2 applications that interact with each other and share activity between each other.
So, i don't know which exactly application will be ActiveApplication in each moment of time, i also not sure what will be a sequence of starting applications. That's why i want to have variable for first application and for second and use this variable in code instead of using ActiveApplication, like it was in my example - app.Windows.Count.
Does it make sense for you?
Thank you for your time and feedback.
I suspect that we are a bit lost in communication. You initially was talking about active windows and as of the latest reply it turns out that you have two applications which should be tested together. At least this is what I understood.
Since the automation scenario you would like to automate is not a straight forward one it is easier to get misunderstood. Would it be possible to prepare a sample applications that will replicate the scenario you experience problems with? It is not required to be something complex but to demonstrate the behavior you observe using the application under test along with a sample test with the used approach.
I would like to better understand the requirements and scenario to cover to be able to provide further advice.
Thanks in advance for your understanding!