Page 1 of 1

How to choose a value from a dictionary

Posted: Sun Nov 11, 2018 10:17 pm
by kronix
Hello
1. I have a dictionary with three values
2.I have a csv file with dictionary values
3. I want the mouse action to choose the dictionary value from the csv file as a variable
4.I am getting this error:
Image


Warning - Action #7: The default value bound to 'ElementLocation' is not recognized as a valid 'Location'. Provide a valid value. - C:\Users\automat\Documents\Ranorex\RanorexStudio Projects\CRM_TEST\CRM_TEST\Recording2.rxrec:7


what am I doing wrong

Re: How to choose a value from a dictionary

Posted: Mon Nov 12, 2018 12:41 pm
by odklizec
Hi,

I'm suspecting that you are trying to use a name of the item you want to click, as a mouse click Location parameter? That's unfortunately wrong. Location specifies the x/y coordinates inside the element's rectangle (element defined by the xpath). What you need to do is to assign the variable to repo item FepDropDownListNoPad. And the xpath of the element should look like body//ul/li/s[@innertext=$dyspozycja]
However, without seeing the snapshot of the element FepDropDownListNoPad, I can only guess it accepts InnerText attribute. So if the above xpaths does not work for you, please upload a Ranorex snapshot (NOT screenshot) of the dropdown list, so I (or anyone else here) can provide you with correct xpath. Thanks.

Re: How to choose a value from a dictionary

Posted: Mon Nov 12, 2018 3:42 pm
by kronix
Yes, I want to do as you write. Attached snapshot. I have to do something wrong because it is still bad.
I just want to choose a value in a dictionary that is assigned to a variable; (;)
Thanks for the help

Re: How to choose a value from a dictionary

Posted: Mon Nov 12, 2018 4:04 pm
by odklizec
Hi,

What exactly is wrong? Is there any error message? And what is the xpath in repo?

Unfortunately, the snapshot does not show the expanded list, but it seems the variabilized xpath you should use, should be like this:
//select[#'MainContent_Content_Rodzaj']/option[@innertext=$dyspozycja][@visible='True']
This xpath, once the var $dyspozycja is correctly filled with, correct content, should point to proper list option. Of course, you must first click the combo box, to expand the list of items.

Re: How to choose a value from a dictionary

Posted: Mon Nov 12, 2018 4:59 pm
by kronix
Ok, I did as you wrote. A better snapshot attached.
I just want Ranorex to choose one of three values ​​in the dictionary. The 'var'Disposition' values ​​are defined in the data source.
Ranorex opens the dictionary, but after opening, he does not choose values
Thank you so much for help. I am a new user of ranorex.

Re: How to choose a value from a dictionary

Posted: Tue Nov 13, 2018 9:00 am
by odklizec
Hi,

Thanks for the snapshot. It's much better now ;) So the xpath should look like this:

Code: Select all

body//ul/li//span[@title=$listItemName and @visible='True']
Where the listItemName should be connected to a dataconnector, containing the list item name. Attribute @visible is not quite necessary here, but it's a good practice to use it in the xpath of dynamically appearing elements, which may be always available (just hidden) in the GUI structure. So the list item will be identified only if the list is open and visible. Hope this helps?