Hi Team,
Is there a way to verify the selected ListBox / ComboBox content.
For example I have a ListBox it contains, Adam, Jeff and Zion as values, now I have selected a value called 'Zion', now I would like to verify the value selected is 'Zion' in the ListBox.
I can do the following steps
1. Clicking on a ListBox (with Repository object)
2. Selecting the appropriate value from a ListBox (with Repository object)
But how to verify the content which is displayed NOW in the ListBox.
Regards,
Dal...
Verifying the list-box selected items
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Verifying the list-box selected items
Hi,
you have to make a validation in your recording.
Therefore create a repository entry for the selected listbox entry with the help of RonorexXPath and validate the text attribute of the corresponding element:
Regards
Tobias
Ranorex Team
you have to make a validation in your recording.
Therefore create a repository entry for the selected listbox entry with the help of RonorexXPath and validate the text attribute of the corresponding element:
- enter corresponding path in Element Browser. E.g.:
Code: Select all
/form[@controlname='Form1']/list/list/listitem[@selected='true']
- Drag the referenced element into your repository
- In your recorder add a validation item with your listitem from repository and validate that the text attribute is equal to e.g. 'Zion'.
Regards
Tobias
Ranorex Team
Re: Verifying the list-box selected items
Hi Team,
Following is my Combo Box object, displayed as "SelectTag"
"/dom[@domain='1.2.3.4']/.//select[@id='nameOfTheComboBox']"
And the options in the list are displayed as:
"/dom[@domain='1.2.3.4']/.//select[@id='nameOfTheComboBox']/option[@InnerText='Item1']"
"/dom[@domain='1.2.3.4']/.//select[@id='nameOfTheComboBox']/option[@InnerText='Item2']"
"/dom[@domain='1.2.3.4']/.//select[@id='nameOfTheComboBox']/option[@InnerText='Item3']"
etc...
But its not clicking as well as not able to verify the selected item value.
I knew by using (Ranorex.ComboBox.SelectedItemText property) we can get the Seleted Item Value. But we need to have RXpath of an object as ""/form[@controlname='TestedApp']/combobox[@controlname='comboBox1']""
Kindly advise...what can be done on the RXPath with SelectTag...
Regards,
Dal...
Following is my Combo Box object, displayed as "SelectTag"
"/dom[@domain='1.2.3.4']/.//select[@id='nameOfTheComboBox']"
And the options in the list are displayed as:
"/dom[@domain='1.2.3.4']/.//select[@id='nameOfTheComboBox']/option[@InnerText='Item1']"
"/dom[@domain='1.2.3.4']/.//select[@id='nameOfTheComboBox']/option[@InnerText='Item2']"
"/dom[@domain='1.2.3.4']/.//select[@id='nameOfTheComboBox']/option[@InnerText='Item3']"
etc...
But its not clicking as well as not able to verify the selected item value.
I knew by using (Ranorex.ComboBox.SelectedItemText property) we can get the Seleted Item Value. But we need to have RXpath of an object as ""/form[@controlname='TestedApp']/combobox[@controlname='comboBox1']""
Kindly advise...what can be done on the RXPath with SelectTag...
Regards,
Dal...
Re: Verifying the list-box selected items
Hi...
I just found out a way to do it...
' Click on the list box
Dim repo As Repository = Repository.Instance
repo.ComboBoxSelectObject.Click
'Getting the currently seleted item from the list box
Dim selectedItemValue As Ranorex.ListItem = "/container[@caption='selectbox']/listitem[@selected='true']"
report.Info(selectedItemValue.Text.ToString)
Plz suggest me if any other better way of doing the same...
Regards,
Dal...
I just found out a way to do it...
' Click on the list box
Dim repo As Repository = Repository.Instance
repo.ComboBoxSelectObject.Click
'Getting the currently seleted item from the list box
Dim selectedItemValue As Ranorex.ListItem = "/container[@caption='selectbox']/listitem[@selected='true']"
report.Info(selectedItemValue.Text.ToString)
Plz suggest me if any other better way of doing the same...
Regards,
Dal...