Hi ,
I want to retrieve the checked property of a list item, looks like this property is dynamic, as when I use spy I am not able to see this property, but when I Cntrl + Win then I do see this.
each list item has a checkbox associated with it, but can't differentiate it. Since I cant see the seperation of checkbox and listitem , my click item also doesnt work, I have to use keyboard press space, but at present cant figure out whether an item is checked or not.
Any help.
I have attached the screenshot for reference
My code
private void HandleFiltersToDeselect(string filter) {
Ranorex.ComboBox combo = Repo.SharedParameters_ParameterProperties.ProjectParameters.Combobox_Category_FilterList;
combo.Click();
ListItem item = combo.FindSingle<ListItem>("//listitem[@text='"+filter+"']");
if(item.Element.GetAttributeValue<bool>("Checked")) {
item.Focus();
Keyboard.Press(Keys.Space);
}
Repo.SharedParameters_ParameterProperties.ProjectParameters.Label_FilterList.Click();
Thanks in advance
Unable to retrive Checked property of listitem
Re: Unable to retrive Checked property of listitem
Hi,
I’m afraid, you forgot to attach the snapshot (do not attach the screenshot, which is unfortunately useless).
I’m afraid, you forgot to attach the snapshot (do not attach the screenshot, which is unfortunately useless).
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 retrive Checked property of listitem
Sorry about that
List '1000' is the dynamic list that appears on Cntrl + Win, cant take a snapshot of it as it says, it no longer valid
List '1000' is the dynamic list that appears on Cntrl + Win, cant take a snapshot of it as it says, it no longer valid
You do not have the required permissions to view the files attached to this post.
Re: Unable to retrive Checked property of listitem
Hi,
Then create the snapshot using Recording module Create Snapshot action. Simply add Create Snapshot action, right after the action, which makes it visible. Then run either the recording alone or entire test suite. This should do the trick. Thanks.
Then create the snapshot using Recording module Create Snapshot action. Simply add Create Snapshot action, right after the action, which makes it visible. Then run either the recording alone or entire test suite. This should do the trick. 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
Re: Unable to retrive Checked property of listitem
Created , but not sure where did it get saved...
You do not have the required permissions to view the files attached to this post.
Re: Unable to retrive Checked property of listitem
You must run the the project and then there should be created a link to snapshot in Report file. The snapshot alone should be created in bin\debug|release\reports folder.
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 retrive Checked property of listitem
here it is
You do not have the required permissions to view the files attached to this post.
Re: Unable to retrive Checked property of listitem
Thanks. Now what exactly is your goal? Get the list of all checked items and uncheck them? Or get the list of all unchecked items and check them?
Basically, you can get the list of all list items and do whatever you want with checked or unchecked list items, with this code:
Where listItemsInfo repo info element should use xpath like this:
Hope this helps? 
Basically, you can get the list of all list items and do whatever you want with checked or unchecked list items, with this code:
Code: Select all
private void HandleFiltersToDeselect(RepoItemInfo listItemsInfo)
{
IList<Ranorex.ListItem> listItems = listItemsInfo.CreateAdapters<Ranorex.ListItem>();
foreach (Ranorex.ListItem item in listItems)
{
if (item.Element.GetAttributeValue<bool>("Checked"))
{
Report.Info("List Item: " + item.Element.GetAttributeValueText("Text").ToString());
item.Focus();
Keyboard.Press(Keys.Space);
}
}
}
Code: Select all
/list[@processName='Revit' and class='ComboLBox'][@visible='true']/listitem

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 retrive Checked property of listitem
I am unable to use this, as I get this error
The non-generic method 'Ranorex.Core.Element.GetAttributeValue(string)' cannot be used with type arguments (CS0308) - C:\Repository\DesignSuite\cablerouting\Ranorex\CableRouting\CableRouting\Revit.Common\Helpers\ProjectParameters.cs:156,22
Tried using GetAttributeValueText, but still same issue
The non-generic method 'Ranorex.Core.Element.GetAttributeValue(string)' cannot be used with type arguments (CS0308) - C:\Repository\DesignSuite\cablerouting\Ranorex\CableRouting\CableRouting\Revit.Common\Helpers\ProjectParameters.cs:156,22
Tried using GetAttributeValueText, but still same issue
Re: Unable to retrive Checked property of listitem
Hi,
Does it fail at this line?...
In this case, use this instead...
Does it fail at this line?...
Code: Select all
if (item.Element.GetAttributeValue<bool>("Checked"))
Code: Select all
if (item.Element.GetAttributeValueText("Checked")="True")
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 retrive Checked property of listitem
Have clicked on the Combobox and trying to select all, but no luck, it doesn't focus on the items at all, neither does the pressing space works
Re: Unable to retrive Checked property of listitem
Hi,
Unfortunately, its hard to tell what's wrong without seeing your app.
Have you debugged the code? Is the iList filled with correct list elements?
Also, have you tried to click each item, instead of using focus and keyboard action? Simply add item.Click(); method, eventually, item.Move(); and item.Click();
Unfortunately, its hard to tell what's wrong without seeing your app.
Have you debugged the code? Is the iList filled with correct list elements?
Also, have you tried to click each item, instead of using focus and keyboard action? Simply add item.Click(); method, eventually, item.Move(); and item.Click();
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