Hi All,
Is it possible to iterate through drop down box and select an item? For an example: I need to create car and assign driver to it from drop down box after that I need to create a new car and assign second driver from drop down box to it and so on. I created Simple Data table for drivers and vehicles but my script always selects first driver in drop down box. Please see an attachment.
how to iterate through drop down box
how to iterate through drop down box
You do not have the required permissions to view the files attached to this post.
Re: how to iterate through drop down box
Hi,
It' hard to say what's wrong without seeing your recording, elements xpaths and connection of data table to module variable.
Here is a simple example how to use data driven approach with combo boxes:
In repository, add a variable representing the name of driver you want to select from combo. In my example "driveLetter"... If your list of names is long and some names may not be visible after expanding the combo box, use InvokeAction with EnsureVisible command. This should make the "invisible" item visible.
Now create the data source with names that should be selected in combo box... And finally, connect the data table column with the module variable: Finally, run the test suite. If everything is set correctly and it still selects only first name, then there is probably something else wrong. Selecting items in combo boxes is always tricky (depends of used technology).
Could you please post the snapshot of combo box in question and eventually screenshot of your recording module with visible selection actions and repository items?
It' hard to say what's wrong without seeing your recording, elements xpaths and connection of data table to module variable.
Here is a simple example how to use data driven approach with combo boxes:
In repository, add a variable representing the name of driver you want to select from combo. In my example "driveLetter"... If your list of names is long and some names may not be visible after expanding the combo box, use InvokeAction with EnsureVisible command. This should make the "invisible" item visible.
Now create the data source with names that should be selected in combo box... And finally, connect the data table column with the module variable: Finally, run the test suite. If everything is set correctly and it still selects only first name, then there is probably something else wrong. Selecting items in combo boxes is always tricky (depends of used technology).
Could you please post the snapshot of combo box in question and eventually screenshot of your recording module with visible selection actions and repository items?
You do not have the required permissions to view the files attached to this post.
Last edited by odklizec on Tue Nov 04, 2014 7:47 pm, edited 1 time in total.
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: how to iterate through drop down box
Yes, it is possible with data-driven testing. You will have to "variable-ize" your selection for the drop-down and pass in the value you want.
There are many ways to do this.
Also, each browser will behave differently when trying to select a value from the list, so you may have to write some code.
One thing you could try instead is just typing in the value you want. Most drop-down lists will automatically select the item that matches what is typed into the drop-down. Just do the following:
1. Mouse -> Click -> Left -> Center -> DropdownRepoItem
2. Key -> Sequence -> $value -> DropdownRepoItem
This should work for all browsers, but it might not. It's worth a try.
There are many ways to do this.
Also, each browser will behave differently when trying to select a value from the list, so you may have to write some code.
One thing you could try instead is just typing in the value you want. Most drop-down lists will automatically select the item that matches what is typed into the drop-down. Just do the following:
1. Mouse -> Click -> Left -> Center -> DropdownRepoItem
2. Key -> Sequence -> $value -> DropdownRepoItem
This should work for all browsers, but it might not. It's worth a try.
Shortcuts usually aren't...
Re: how to iterate through drop down box
Hi guys,
Thank you very much for your help.
I just added Driver names to Simple Data Table. Actually how it is working when I select Add button it will display all drivers where you have to select driver I used "enter" and assign it as variable and after that connect it to data table. Everything is working perfectly.
Thank you very much for your help.
I just added Driver names to Simple Data Table. Actually how it is working when I select Add button it will display all drivers where you have to select driver I used "enter" and assign it as variable and after that connect it to data table. Everything is working perfectly.