How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
Hello,
Setup: Ranorex 5.3 with Visual Studio as our IDE (with Ranorex repositories).
I need to specify the new Plugin 'WPF Legacy/UIA Interaction' = UiaPreferred. I had assumed that updating the setting in Spy Plugins, then saving the repository, that the setting would filter through to the project in Visual Studio. But this does not work, it's still the default setting of WpfPreferred.
Is there code that I can use to force this setting of 'WPF Legacy/UIA Interaction' = UiaPreferred ?
Or how can I get the setting to filter through to our Visual Studio project?
Cheers
Setup: Ranorex 5.3 with Visual Studio as our IDE (with Ranorex repositories).
I need to specify the new Plugin 'WPF Legacy/UIA Interaction' = UiaPreferred. I had assumed that updating the setting in Spy Plugins, then saving the repository, that the setting would filter through to the project in Visual Studio. But this does not work, it's still the default setting of WpfPreferred.
Is there code that I can use to force this setting of 'WPF Legacy/UIA Interaction' = UiaPreferred ?
Or how can I get the setting to filter through to our Visual Studio project?
Cheers
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
Hello Benny,
In order to set the WPF Legacy / UIA Interaction settings in code you can use the following:
May I therefore ask you to upgrade to Ranorex 5.3.1 and to check if it works with this version?
Regards,
Markus
In order to set the WPF Legacy / UIA Interaction settings in code you can use the following:
Ranorex.Plugin.WpfConfiguration.WpfApplicationTrees = Ranorex.Plugin.WpfTreeSelection.<UiaOnly/UiaPreferred/WpfOnly/WpfPreferred>;I also did a small test with the setting of the plugins tab, but in my case this worked, so the setting used was also applied to the tests executed from Visual Studio.
May I therefore ask you to upgrade to Ranorex 5.3.1 and to check if it works with this version?
Regards,
Markus
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
Thanks Markus, the direct code in VS worked.
I've now upgraded to 5.3.1 and it seems to be working correctly now.
Am I correct in saying that there is no way to tell from either the .Repository.cs or .rxrep files, how this pluin is set?
Can different Repositories have this setting set differently, or is the setting specific to the whole project?
I've now upgraded to 5.3.1 and it seems to be working correctly now.
Am I correct in saying that there is no way to tell from either the .Repository.cs or .rxrep files, how this pluin is set?
Can different Repositories have this setting set differently, or is the setting specific to the whole project?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
Hi Benny,
Yes, it is not possible from the repository to tell how the plugin is set.
The setting is a general setting, so applies to all projects of your machine.
To be sure that the new settings are properly saved you should use the following code:
Your old UIA tests/repository items should still work when you use WpfPreferred and the new WPF tests/repository items should also run with the setting UiaPreferred, respectively, so there shouldn't be a need to change that on a repository basis.
Please do let me know if I got something wrong here.
Regards,
Markus
Yes, it is not possible from the repository to tell how the plugin is set.
The setting is a general setting, so applies to all projects of your machine.
To be sure that the new settings are properly saved you should use the following code:
Configuration.Current.SaveToUserSettings();Why do you want it repository specific?
Your old UIA tests/repository items should still work when you use WpfPreferred and the new WPF tests/repository items should also run with the setting UiaPreferred, respectively, so there shouldn't be a need to change that on a repository basis.
Please do let me know if I got something wrong here.
Regards,
Markus
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
I think the issue is that if the UiaPrefered setting works with the SUT, it works everywhere, but if it doesn't work with the SUT, it won't work anywhere, so it would be better to have the setting saved with the solution/project instead of on the user's system.
I would agree with Benny on this one. Some of the settings that are machine specific, currently, might be better as solution or project settings because they may need to be distributed to all Ranorex installs with the solutions.
Note: I don't have this problem right now, so I couldn't point out any specific settings.
But, it's just my 2 cents...
I would agree with Benny on this one. Some of the settings that are machine specific, currently, might be better as solution or project settings because they may need to be distributed to all Ranorex installs with the solutions.
Note: I don't have this problem right now, so I couldn't point out any specific settings.
But, it's just my 2 cents...
Shortcuts usually aren't...
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
Hi krstcs,
Thank you for your valuable input kelly.
In case of the specific WPF setting I would agree.
Beside this setting, which other settings do you think are better to have project specific?
Regards,
Markus
Thank you for your valuable input kelly.
In case of the specific WPF setting I would agree.
Beside this setting, which other settings do you think are better to have project specific?
Regards,
Markus
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
I use the default settings for my projects, I haven't found any need to change them yet. (And that also means that I may not realize that some of these are already in the solution... )
I could see things like the following being in a solution config file instead of machine local:
GDI Capture settings
XPath weights and capture mode (this may need to change depending on the project)
Use asynchronous dispatching of mouse and keyboard events (again may need changes in each solution)
But, these are examples. I just think that anything that might depend on the SUT should probably be in a solution-level config file instead of in a machine-level file. It just makes more sense to me to keep those things together. It would also make sharing those configurations easier by allowing them to be put under version control with the source.
I could see things like the following being in a solution config file instead of machine local:
GDI Capture settings
XPath weights and capture mode (this may need to change depending on the project)
Use asynchronous dispatching of mouse and keyboard events (again may need changes in each solution)
But, these are examples. I just think that anything that might depend on the SUT should probably be in a solution-level config file instead of in a machine-level file. It just makes more sense to me to keep those things together. It would also make sharing those configurations easier by allowing them to be put under version control with the source.
Shortcuts usually aren't...
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
Hi Kelly,
You are right, this would make definitely sense.
I will forward this request.
Thanks,
Markus
You are right, this would make definitely sense.
I will forward this request.
Thanks,
Markus
-
- Posts: 16
- Joined: Wed Aug 17, 2016 9:26 am
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
Hi All
I am using Ranorex 6.0.1. while automating my desktop application In Global setting I have kept 'WPF Legacy/UIA Interaction' = UiaPreferred and captured controls,
However in some of the Ranorex couldn't find some of the WPF controls,So I changed WPF Legacy/UIA Interaction' = WpfPreferred and then Ranorex was able to find those controls.
While running the test case by default value of WPF Legacy/UIA Interaction' = UiaPreferred , Whenever I needed I changed it to WpfPreferred using usercode ( Ranorex.Plugin.WpfConfiguration.WpfApplicationTrees = Ranorex.Plugin.WpfTreeSelection.WpfPreferred;)
and changing it back to Ranorex.Plugin.WpfConfiguration.WpfApplicationTrees = Ranorex.Plugin.WpfTreeSelection.UiaPreferred;
Sometimes this works and sometimes it doesn't.
Could you please suggest me if any other way is possible ?
Let me know if you want some more clarity on this.
Regards,
Manish
I am using Ranorex 6.0.1. while automating my desktop application In Global setting I have kept 'WPF Legacy/UIA Interaction' = UiaPreferred and captured controls,
However in some of the Ranorex couldn't find some of the WPF controls,So I changed WPF Legacy/UIA Interaction' = WpfPreferred and then Ranorex was able to find those controls.
While running the test case by default value of WPF Legacy/UIA Interaction' = UiaPreferred , Whenever I needed I changed it to WpfPreferred using usercode ( Ranorex.Plugin.WpfConfiguration.WpfApplicationTrees = Ranorex.Plugin.WpfTreeSelection.WpfPreferred;)
and changing it back to Ranorex.Plugin.WpfConfiguration.WpfApplicationTrees = Ranorex.Plugin.WpfTreeSelection.UiaPreferred;
Sometimes this works and sometimes it doesn't.
Could you please suggest me if any other way is possible ?
Let me know if you want some more clarity on this.
Regards,
Manish
-
- Posts: 16
- Joined: Wed Aug 17, 2016 9:26 am
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
Hi Support Team,
Any updates on this ?
Regards
Manish
Any updates on this ?
Regards
Manish
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
Hello Manish,
May I ask what exactly happens? Which error message do you get?
Also, we highly recommend sticking to one plugin, either UIA or WPF. Please try to limit the switching between those plugins.
Looking forward to hearing from you.
Sincerely,
Robert
May I ask what exactly happens? Which error message do you get?
Also, we highly recommend sticking to one plugin, either UIA or WPF. Please try to limit the switching between those plugins.
Looking forward to hearing from you.
Sincerely,
Robert
-
- Posts: 16
- Joined: Wed Aug 17, 2016 9:26 am
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
Hi Robert,
It doesnt give any error message.
I have captured object by keeping 'WPF Legacy/UIA Interaction' = UiaPreferred. setting.
Object Identification of some of the wpf element is not possible in application which I am trying to automate.
So when I change setting to WPF Legacy/UIA Interaction' = WpfPreferred it identifies object.
whenever I am dealing with those wpf elements which are not recognized using UiaPreffered setting, by using usercode I am changing the WPF Legacy/UIA Interaction settings as mentioned in above question.
sometimes it works and sometimes it doesn't .
Do we have some other way to change this setting ?
I am not using WPF Legacy/UIA Interaction' = WpfPreferred setting through out because xpath becomes very long.
Regards,
Manish
It doesnt give any error message.
I have captured object by keeping 'WPF Legacy/UIA Interaction' = UiaPreferred. setting.
Object Identification of some of the wpf element is not possible in application which I am trying to automate.
So when I change setting to WPF Legacy/UIA Interaction' = WpfPreferred it identifies object.
whenever I am dealing with those wpf elements which are not recognized using UiaPreffered setting, by using usercode I am changing the WPF Legacy/UIA Interaction settings as mentioned in above question.
sometimes it works and sometimes it doesn't .
Do we have some other way to change this setting ?
I am not using WPF Legacy/UIA Interaction' = WpfPreferred setting through out because xpath becomes very long.
Regards,
Manish
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
Hello Manish,
Thank you for getting back to me.
Unfortunately, I'm not sure why it is even necessary to switch between WpfPreferred and UIAPreferred. All paths should be found during test execution.
If you still want to switch, please try to save the configuration right after performing the switch:
There is no other code for switching the WPF settings.
Sincerely,
Robert
Thank you for getting back to me.
Unfortunately, I'm not sure why it is even necessary to switch between WpfPreferred and UIAPreferred. All paths should be found during test execution.
If you still want to switch, please try to save the configuration right after performing the switch:
Code: Select all
Configuration.Current.SaveToUserSettings();
Sincerely,
Robert
-
- Posts: 16
- Joined: Wed Aug 17, 2016 9:26 am
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
Hi Robert
Yes, During test execution I can find the all the path now, but its taking some more time.
I will try the solution you have given.
Thank you
Regards,
Manish
Yes, During test execution I can find the all the path now, but its taking some more time.
I will try the solution you have given.
Thank you
Regards,
Manish
Re: How to set plugin 'WPF/UIA' = UiaPreferred in VS code?
Doesn't work this way. Version 7.2.1 is not able to find components using UIA paths if current mode was set to WpfImrovedOnly and vice versa.Support Team wrote: All paths should be found during test execution.
At least in my case (WPF, Telerik).
For example UIA-based path:
Code: Select all
/form[@processname='app.Shell']/progressbar/element[@classname='RadTransitionControl']/element[@classname='CommonView']/element[@automationid='Docking']/element[@classname='RadSplitContainer']/tabpagelist/tabpage[@automationid='SubModulesPane']/progressbar/tabpagelist/tabpage[@name='Information']
The same control based on WpfImrovedOnly:
Code: Select all
/form[@processname='app.Shell'']/progressbar/list[@automationid='Docking']/container[@automationid='Root']/?/?/tabpage[@automationid='SubModulesPane']//container[@automationid='HeaderDockedElement']/tabpage[@title='Information']
Doesn't help.Code: Select all
Configuration.Current.SaveToUserSettings();
At least this combination doesn't work for me:
Code: Select all
private void Init()
{
Report.Info("Setting WpfTreeSelection.UiaOnly");
Ranorex.Plugin.WpfConfiguration.WpfApplicationTrees = Ranorex.Plugin.WpfTreeSelection.UiaOnly;
Configuration.Current.SaveToUserSettings();
}
In some cases WpfImrovedOnly mode causes a SUT (WPF+Telerik) to hang (with RAM leakage).
It happens exactly after Ranorex inject its dlls (Ranorex.Core.Injection.dll) into SUT process.
And it happens in case when the SUT is x64-based application (unfortunately we have no x86 version and I can't check this) and a 32/64 bit Bridge is used.
I've just checked this scenario using TestComplete - no problem, SUT works fine...
ps/ unfortunately I can't send you a part of app to reproduce this issue... this is a huge corporate level BIM-system.