Selecting a value from the drop down list

Ask general questions here.
PraveenPriya21
Posts: 2
Joined: Tue Nov 15, 2016 4:25 am

Selecting a value from the drop down list

Post by PraveenPriya21 » Tue Nov 15, 2016 4:44 am

Hi Team,

I am using ranorex 6.0 for testing desktop applications using c sharp. I use data driven testing by linking the recording with a simple data connector. I use the following function SelectValue

public void SelectValue(string dataval)
{
Keyboard.Press(dataval);
Keyboard.Press("{Enter}");
}
for selecting the value from the drop down lists.

When I used this function while testing my application in Windows 8 OS, there we no issues while selecting values from the drop down lists, which ranorex will take from the data sheet. But when I test my Windows 7 application, it sometimes go to the right value, then selects the wrong value, that is not mentioned in the data sheet. This happens only for few drop downs, for example, if there are 25 drop downs, this function selects the right value 20 times and fails 5 times. Please let me know how to improve the function so it selects the right value all the time.
Last edited by PraveenPriya21 on Tue Nov 15, 2016 11:58 am, edited 1 time in total.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Selecting a value from the drop down list

Post by odklizec » Tue Nov 15, 2016 8:43 am

Hi,

At first, please update Ranorex with latest 6.1.1. Ranorex 6.0 contained several major bugs, so it;s better to use latest 6.1.1. At second, please upload a Ranorex snapshot of the failing listbox(es). Ideally, take the snapshot both on Win 7 and 8. Then add "PrepareFocus" method before entering dataval string. And finally, instead of "Press" use "PressKeys" method (for dataval entry). This should help with sending correct keys to correct element. Use Press method just for sending shortcuts. Hope this helps?
Pavel Kudrys
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

PraveenPriya21
Posts: 2
Joined: Tue Nov 15, 2016 4:25 am

Re: Selecting a value from the drop down list

Post by PraveenPriya21 » Wed Nov 16, 2016 5:53 am

odklizec wrote:
At first, please update Ranorex with latest 6.1.1.
Hi,
I am using Ranorex 6.1.0 (updated)
Then add "PrepareFocus" method before entering dataval string.
How to add this function? I am new to coding. Please specify the logic behind adding the PrepareFocus function. if it is a build in function, please specify the reference to be added to use it.
And finally, instead of "Press" use "PressKeys" method (for dataval entry).
I am getting an error that Ranorex.Keyboard does not contain definition for PressKeys
Win 8 system.PNG
Win 7 system.PNG
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Selecting a value from the drop down list

Post by odklizec » Wed Nov 16, 2016 8:39 am

Hi,

By the "Snapshot" I meant Ranorex Snapshot, not a screenshot ;) Please follow the steps described here:
http://www.ranorex.com/support/user-gui ... files.html

As for Focus and PressKeys methods, you don't have to code anything. Just drag&drop the drown list element from repository to recording of your choice and then from the appeared menu select "Invoke Action" >> "Focus" (for Focus) and "KeySequence" (for sequence of keys). Hope this helps?
Pavel Kudrys
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