DesiredCapabilities appCapabilities = new DesiredCapabilities();
appCapabilities.SetCapability("app", @"C:\myWPFApp.exe");
NotepadSession = new IOSDriver<IOSElement>(new Uri(AppDriverUrl), appCapabilities);
On the third line it starts my app and just hangs.
But with Native Win32/UWP applications driver creates correctly and quickly.
Is there a way to prevent driver from hanging when starting WPF/WinForm applications?
I've reproduced the bug. Thanks for filing this. We're investigating.
Is there any update on the WPF/Winforms issue?
We have a fix implemented that will be available in the next release
Is there a nightly drop that we can use until you guys get the next release rolling? I'd really like to start adapting this, but the wpf/winforms issue is a huge blocker.
When you guys are releasing new build?
Is there a fix or a workaround for this issue?
This is not a workaround... I suggest nightly build drops to be provided as well. Yes, it's beta and all but having these beta versions plus nightly builds gives me and my team the benefit to integrate this thing faster within our organization. This might lead to more issues, which is not necessarily a bad thing. Nevertheless, blockers like this issue will be fixed and delivered much faster. Nightly builds => more immediate feedback => less blockers => more users => stronger community => even more feedback => better quality.
Please let us know when can we expect the fix for wpf applications (as winappdriver doesnt work for wpf app currently) .
Today is Nov 30, was expecting the new release today. Please provide us the fix ASAP as this is blocker for us
I would also like to know when we can expect a fix for this or a workaround so we can start experimenting.
Thanks for your patience. We're trying to get a release out by EOD today.
@yodurr Just saw the release, but it states WPF only. What about WinForms? Is this going to be supported?
Yes WinForms support is included. We'd really appreciate if you can try 0.7 and please file a bug if聽it isn't working for you. Thanks!
Hi @yodurr,
thanks for the release, a session for WinForms application is created (previously it was hanging on that line).
However, now I have a problem with selecting an element. I have a simple WinForms app with a TextBox called textBox1, but neither session.FindElementById nor session.FindElementByName methods are not able to find that element:
System.InvalidOperationException: An element could not be located on the page using the given search parameters.
The PageSource property of the session contains this fragment
<Edit AcceleratorKey="" AccessKey="" AutomationId="textBox1"
ClassName="WindowsForms10.EDIT.app.0.2bf8098_r9_ad1" FrameworkId="WinForm"
HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True"
IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="False" IsPassword="False"
IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="edit"
Name="" Orientation="None" ProcessId="13860" RuntimeId="42.331658"
x="151" y="158" width="100" height="20" />
The element can be located using FindElementByTagName method.
Thanks for the help (maybe I'm missing something basic).
Karel
Working for me now (sometimes but I think that is due to the app under test).
@ianceicys Can you post the fragment of the PageSource XML document?
Hi..After using the latest release , my wpf app opens up successfully. But am not able to locate any element using id or classname or name. Am i missing something?
Note: Am using Inspect tool to locate the element.
@ianceicys, it works! It works with a session created by using both RemoteWebDrive and IOSDriver<IOSElement> classes.
It still does not work for WinForms app ...
What I noticed is that elements in WPF app do have Name and do not have AutomationId (at least in the PageSource XML document):
<MenuItem AcceleratorKey="" AccessKey="Alt+F" AutomationId="" ClassName="MenuItem"
FrameworkId="WPF" HasKeyboardFocus="False" HelpText=""
IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True"
IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType=""
LocalizedControlType="menu item" Name="File" Orientation="None" ProcessId="27144"
RuntimeId="7.27144.34576242" x="138" y="161" width="33" height="21"
ExpandCollapseState="Collapsed" IsAvailable="True" />
If you are willing to give it a try, there's a project I created at https://github.com/kfrajtak/UITesting (you'll have to change the hard-coded paths).
Thanks,
Karel
@kfrajtak . Am also working in WPF app. Some of the elements have 'AutomationId' & some have 'Name'. But when I use AutomationId or Name , it doesn't locate the element. For some reason it fails with element not found exception. Is there any solution or workaround for this issue?
@ianceicys
I tired as you said.

The field corresponding to LocalizedControlType was "tab item". So I used it as below in my code
Session.FindElementByTagName("tab item").Click();
Still It didnt work. Am i missing something? Please let me know your thoughts
Hi @ianceicys
Am trying to automate the WPF app that we are using in our project. In our application the LocalizedControlType is "tab item". Hence I used Session.FindElementByTagName("tab item").Click();
This didnt work. It isnt able to locate the element
working like a charm .. Just tested on my WPF app. Will post issues, if any.
Q) In selenium, when click event occur then it wait for next page to load. Can we achieve same functionality with this framework too, without explicitly holding thready by using sleep?
One more observation, I was playing with one of my old WPF app where the starting point is set to splash screen. On that screen, am asking the user to log in and once the user is authenticated that screen would unload and open another screen which is basically the main app. I'm trying to automate this scenario but couldn't able to crack - how to start another session with another screen, basically. If I use existing session then getting - "Currently selected window has been closed". Please help me to automate this scenario.
Hi @rahul24,
Would you mind opening this as a new issue, that聽can have its own discussion? That聽way聽we can聽keep the聽topic of the thread.
Thanks
Hi @khouzam,
how about the problems with the WinForms application? Can you have a look at it?
Thanks
Hi @ianceicys
I tried using var elementsfound = session.FindElements(); to find out all the elements in the wpf app. But unfortunately it didnt work. Is there a way to find the list of elements in the wpf app which is detected by the driver
closing. please open new issues if anything wasn't addressed. Thanks.
Most helpful comment
I've reproduced the bug. Thanks for filing this. We're investigating.