Hi ,
For our desktop applications . I have a drop down. I want to check the selected item in the drop down, unable to do so .
I need to checkthe selected item for Combobox CableTypeComboBox
Attached the snapshot of the control.... using uipreffered and wpf both.
thanks
rajee
unable to find selected text in a drop down
unable to find selected text in a drop down
You do not have the required permissions to view the files attached to this post.
Re: unable to find selected text in a drop down
Hi rsudhak,
I've downloaded this demo: Telefik WPF
I searched for RadDropDownButton to find the control that you are using and I created a few steps of navigation 2 levels deep into the menu. Truly, the composition of this control is "strange" for someone who is used to standard WPF controls Don't use UIA for this control, please use WpfImprovedOnly. I was able to create a simple test by tracking the elements with Ranorex Spy, adding them to the repository manually and then creating the mouse-move/click actions. Have you already tried that?
You also did not really explain what you mean by "unable to do so". Please be more specific. What did you try and what failed?
Regards,
McTurtle
I've downloaded this demo: Telefik WPF
I searched for RadDropDownButton to find the control that you are using and I created a few steps of navigation 2 levels deep into the menu. Truly, the composition of this control is "strange" for someone who is used to standard WPF controls Don't use UIA for this control, please use WpfImprovedOnly. I was able to create a simple test by tracking the elements with Ranorex Spy, adding them to the repository manually and then creating the mouse-move/click actions. Have you already tried that?
You also did not really explain what you mean by "unable to do so". Please be more specific. What did you try and what failed?
Regards,
McTurtle
Re: unable to find selected text in a drop down
Thanks for the reply .Can I use wpfimproved just for the particular dropdown list in the code?
Re: unable to find selected text in a drop down
Hi,
You can learn here how to switch between wpfimproved and wpfonly using code:
viewtopic.php?f=16&t=10871&p=43882
You can learn here how to switch between wpfimproved and wpfonly using code:
viewtopic.php?f=16&t=10871&p=43882
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: unable to find selected text in a drop down
Currently, my scenario is to switch to wpfimprovedonly, and check the caption of the element which is a text, then switch back to ui , while doing so I am getting an error wherein path cant be generated:
string actualStep1 = EditProperties.selected_InstallMethod();
if ((actualStep1.Trim()).Equals(InstallationMethod_Step1.Trim()))
Report.Success("For cable Id:" +Cable_ID + "Install Method Step1 matches");
else
Report.Failure("For cable Id:" +Cable_ID + ", Actual:"+EditProperties.selected_InstallMethodStep1() + " where as Expected:" + InstallationMethod_Step1);
public static string selected_InstallMethod() {
string step1 = CablesHelper.selected_installMethodStep1();
Ranorex.Plugin.WpfConfiguration.WpfApplicationTrees = Ranorex.Plugin.WpfTreeSelection.UiaPreferred;
Configuration.Current.SaveToUserSettings();
return step1;
}
public static string selected_installMethodStep1() {
Ranorex.Plugin.WpfConfiguration.WpfApplicationTrees = Ranorex.Plugin.WpfTreeSelection.WpfImprovedOnly;
Configuration.Current.SaveToUserSettings();
string step1 = Utilities.getAttributeCaption(ProDesign.CableSettingsDialog.List_InstallationMethodsStep1Info);
return step1;
}
public static string getAttributeCaption(RepoItemInfo element) {
string path = element.AbsolutePath.ToString();
try{
return Ranorex.Core.Element.FromPath(path).GetAttributeValueText("Caption");
}
catch(Exception e) {
Report.Info(e.StackTrace.ToString());
Report.Info(e.InnerException.ToString());
return Ranorex.Core.Element.FromPath(path).GetAttributeValueText("Caption");
}
}
I get the below error:
Object reference not set to an instance of an object.
Show/Hide Stacktrace
at ProdesignAutomatedTesting.ProDesign_Files.UI_Elements_Engine.Utilities.getAttributeCaption(RepoItemInfo element) in c:\git\designsuiteautomatedtesting\ProdesignAutomatedTesting\ProdesignAutomatedTesting\ProDesign Files\UI Elements Engine\Utilities.cs:line 241at ProdesignAutomatedTesting.ProDesign_Files.UI_Elements_Engine.CablesHelper.selected_installMethodStep1() in c:\git\designsuiteautomatedtesting\ProdesignAutomatedTesting\ProdesignAutomatedTesting\ProDesign Files\UI Elements Engine\CablesHelper.cs:line 476at ProdesignAutomatedTesting.ProDesign_Files.ProDesign_Dialog_Events.EditProperties.selected_InstallMethodStep1() in c:\git\designsuiteautomatedtesting\ProdesignAutomatedTesting\ProdesignAutomatedTesting\ProDesign Files\ProDesign Dialog Events\EditProperties.cs:line 587at ProdesignAutomatedTesting.ProDesign_Files.ProDesign_General_Functions.CoreCables.Ranorex.Core.Testing.ITestModule.Run() in c:\git\designsuiteautomatedtesting\ProdesignAutomatedTesting\ProdesignAutomatedTesting\ProDesign Files\ProDesign General Functions\CoreCables.cs:line 267at Ranorex.Core.Testing.TestModuleLeaf.RunInternal(DataContext parentDataContext, Int32 iteration, Int32 iterationCount, Boolean skipIteration)
Am I doing something wrong?
string actualStep1 = EditProperties.selected_InstallMethod();
if ((actualStep1.Trim()).Equals(InstallationMethod_Step1.Trim()))
Report.Success("For cable Id:" +Cable_ID + "Install Method Step1 matches");
else
Report.Failure("For cable Id:" +Cable_ID + ", Actual:"+EditProperties.selected_InstallMethodStep1() + " where as Expected:" + InstallationMethod_Step1);
public static string selected_InstallMethod() {
string step1 = CablesHelper.selected_installMethodStep1();
Ranorex.Plugin.WpfConfiguration.WpfApplicationTrees = Ranorex.Plugin.WpfTreeSelection.UiaPreferred;
Configuration.Current.SaveToUserSettings();
return step1;
}
public static string selected_installMethodStep1() {
Ranorex.Plugin.WpfConfiguration.WpfApplicationTrees = Ranorex.Plugin.WpfTreeSelection.WpfImprovedOnly;
Configuration.Current.SaveToUserSettings();
string step1 = Utilities.getAttributeCaption(ProDesign.CableSettingsDialog.List_InstallationMethodsStep1Info);
return step1;
}
public static string getAttributeCaption(RepoItemInfo element) {
string path = element.AbsolutePath.ToString();
try{
return Ranorex.Core.Element.FromPath(path).GetAttributeValueText("Caption");
}
catch(Exception e) {
Report.Info(e.StackTrace.ToString());
Report.Info(e.InnerException.ToString());
return Ranorex.Core.Element.FromPath(path).GetAttributeValueText("Caption");
}
}
I get the below error:
Object reference not set to an instance of an object.
Show/Hide Stacktrace
at ProdesignAutomatedTesting.ProDesign_Files.UI_Elements_Engine.Utilities.getAttributeCaption(RepoItemInfo element) in c:\git\designsuiteautomatedtesting\ProdesignAutomatedTesting\ProdesignAutomatedTesting\ProDesign Files\UI Elements Engine\Utilities.cs:line 241at ProdesignAutomatedTesting.ProDesign_Files.UI_Elements_Engine.CablesHelper.selected_installMethodStep1() in c:\git\designsuiteautomatedtesting\ProdesignAutomatedTesting\ProdesignAutomatedTesting\ProDesign Files\UI Elements Engine\CablesHelper.cs:line 476at ProdesignAutomatedTesting.ProDesign_Files.ProDesign_Dialog_Events.EditProperties.selected_InstallMethodStep1() in c:\git\designsuiteautomatedtesting\ProdesignAutomatedTesting\ProdesignAutomatedTesting\ProDesign Files\ProDesign Dialog Events\EditProperties.cs:line 587at ProdesignAutomatedTesting.ProDesign_Files.ProDesign_General_Functions.CoreCables.Ranorex.Core.Testing.ITestModule.Run() in c:\git\designsuiteautomatedtesting\ProdesignAutomatedTesting\ProdesignAutomatedTesting\ProDesign Files\ProDesign General Functions\CoreCables.cs:line 267at Ranorex.Core.Testing.TestModuleLeaf.RunInternal(DataContext parentDataContext, Int32 iteration, Int32 iterationCount, Boolean skipIteration)
Am I doing something wrong?
Re: unable to find selected text in a drop down
Sorry to come back to this, currently I have a csv data source, on the first iteration it runs fine, switching to WpfimprovedOnly and then back to uiPreffered, but in the second iteration it simple fails says No element found for path (Path of WPFimprovedOnly) , any idea as it why this is happening?
Re: unable to find selected text in a drop down
Hi,
Are you sure, that Ranorex is set to wpfimprovedonly before the next iteration? Please create the app snapshot (from code), right before the failing step. Then examine if the xpath you are using in repo is still valid and eventually change it.
Are you sure, that Ranorex is set to wpfimprovedonly before the next iteration? Please create the app snapshot (from code), right before the failing step. Then examine if the xpath you are using in repo is still valid and eventually change it.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: unable to find selected text in a drop down
Before moving to the next iteration , i do set it back to uipreferred because by default its uipreferred, only for certain drop downs I switch back to wpfimprovedonly, how can I create a app spanshot?
Re: unable to find selected text in a drop down
Hi,
And this is most probably source of your problem! If the xpath in repo is wpfimprovedonly-based, you must again switch to wpfimprovedonly, in case you want to access such element. You can take snapshot with Report.Snapshot method.
And this is most probably source of your problem! If the xpath in repo is wpfimprovedonly-based, you must again switch to wpfimprovedonly, in case you want to access such element. You can take snapshot with Report.Snapshot method.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: unable to find selected text in a drop down
Yes, xpath is wpfimprovedonly , just before accessing this element I switch to wpfimproved , once the action of the element is done I switch back to uipreferred , and this runs fine for the first iteration, but the second one fails, is there a way to check which is the current plugin?
added Report.snapshot, cant see any link on the report, any links for reference please
added Report.snapshot, cant see any link on the report, any links for reference please
Re: unable to find selected text in a drop down
Any update on this would be of great help, I see random failures finding the WPFImprovedOnly element, before accessing the the element , I do check whether its wpfImprovedonly, its identifies as wpfimprovedonly, but fails to find the element, just sample report attached for reference
You do not have the required permissions to view the files attached to this post.
Re: unable to find selected text in a drop down
Hi,
There is not much to add I'm afraid. As long as you don't provide another snapshot, created just before accessing the problematic element, there is unfortunately nothing anyone here can do or suggest. Ideally, take the snapshot for each iteration.
Looking at both snapshots you already provided, the xpath in your report does not work in neither of them, so I'm curious, with what settings you recorded such xpath?
This is the xpath from your report:
'/form[@title='Cable Settings' or @title~'^Final\ Circuit\ ' or @title~'^Lighting\ Column\ ' and @processname='ProDesign']/?/?/container[@automationid='ComponentSettingsView']/?/?/container[@automationid='PageContentControl']//combobox[@automationid='InstallationMethodGroupComboBox']/button[@automationid='PART_DropDownButton']/text
And this xpath actually works in wpf.rxsnp:
/form[@title='Cable Settings' or @title~'^Final\ Circuit\ ' or @title~'^Lighting\ Column\ ' and @processname='ProDesign']//container[@automationid='ComponentSettingsView']//element[@automationid='PageContentControl']//list[@automationid='InstallationMethodGroupComboBox']//checkbox[@automationid='PART_DropDownButton']//text
Do you see the differences?
And in the other snapshot (wew.rxsnp - the one taken in UIA only mode), it looks even more differently, plus there are no combo box sublements recognized, so it can be found only up to the combobox element...
/form[@title='Cable Settings' or @title~'^Final\ Circuit\ ' or @title~'^Lighting\ Column\ ' and @processname='ProDesign']/element[@automationid='ComponentSettingsView']//element[@automationid='CableTypeViewElement']/combobox[@automationid='InstallationMethodGroupComboBox'] The WPF mode clearly shows more elements, but I agree some element types are recognized weirdly (e.g. list instead of combobox).
All in all, the xpath from report is most probably not good for neither wpf settings you've used, while generating both snapshots.
BTW, you should definitely update Ranorex to most recent 9.0.1, because 8.3.1 is already outdated and there were many bug fixes and improvements done since then, which may include also some WPF-related things! Debugging such kind of issue with an obsolete version, is just the waste of time and energy
There is not much to add I'm afraid. As long as you don't provide another snapshot, created just before accessing the problematic element, there is unfortunately nothing anyone here can do or suggest. Ideally, take the snapshot for each iteration.
Looking at both snapshots you already provided, the xpath in your report does not work in neither of them, so I'm curious, with what settings you recorded such xpath?
This is the xpath from your report:
'/form[@title='Cable Settings' or @title~'^Final\ Circuit\ ' or @title~'^Lighting\ Column\ ' and @processname='ProDesign']/?/?/container[@automationid='ComponentSettingsView']/?/?/container[@automationid='PageContentControl']//combobox[@automationid='InstallationMethodGroupComboBox']/button[@automationid='PART_DropDownButton']/text
And this xpath actually works in wpf.rxsnp:
/form[@title='Cable Settings' or @title~'^Final\ Circuit\ ' or @title~'^Lighting\ Column\ ' and @processname='ProDesign']//container[@automationid='ComponentSettingsView']//element[@automationid='PageContentControl']//list[@automationid='InstallationMethodGroupComboBox']//checkbox[@automationid='PART_DropDownButton']//text
Do you see the differences?
And in the other snapshot (wew.rxsnp - the one taken in UIA only mode), it looks even more differently, plus there are no combo box sublements recognized, so it can be found only up to the combobox element...
/form[@title='Cable Settings' or @title~'^Final\ Circuit\ ' or @title~'^Lighting\ Column\ ' and @processname='ProDesign']/element[@automationid='ComponentSettingsView']//element[@automationid='CableTypeViewElement']/combobox[@automationid='InstallationMethodGroupComboBox'] The WPF mode clearly shows more elements, but I agree some element types are recognized weirdly (e.g. list instead of combobox).
All in all, the xpath from report is most probably not good for neither wpf settings you've used, while generating both snapshots.
BTW, you should definitely update Ranorex to most recent 9.0.1, because 8.3.1 is already outdated and there were many bug fixes and improvements done since then, which may include also some WPF-related things! Debugging such kind of issue with an obsolete version, is just the waste of time and energy
You do not have the required permissions to view the files attached to this post.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: unable to find selected text in a drop down
Thanks for the reply, I have upgraded to the latest version, but the issue persists
Re: unable to find selected text in a drop down
Hi,
Well, in this case, there is no other option than to create another another set of snapshots, ideally taken in first iteration, where the xpath you are using works and second iteration, where, as you mentioned, it stopped working. And please tell us, what exactly do you want to achieve? And explain why do you mix UIAonly and WPFPreferred modes? Thanks.
Well, in this case, there is no other option than to create another another set of snapshots, ideally taken in first iteration, where the xpath you are using works and second iteration, where, as you mentioned, it stopped working. And please tell us, what exactly do you want to achieve? And explain why do you mix UIAonly and WPFPreferred modes? Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration