Verifying the list-box selected items

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
dal
Posts: 72
Joined: Thu Jun 24, 2010 8:59 am

Verifying the list-box selected items

Post by dal » Wed Sep 22, 2010 9:18 am

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...

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Verifying the list-box selected items

Post by Support Team » Wed Sep 22, 2010 11:38 am

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:
  • 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'.
Have a look at http://www.ranorex.com/support/user-gui ... xpath.html to get more information about RanorexXPath.

Regards
Tobias
Ranorex Team
.
Image

dal
Posts: 72
Joined: Thu Jun 24, 2010 8:59 am

Re: Verifying the list-box selected items

Post by dal » Mon Sep 27, 2010 8:26 am

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...

dal
Posts: 72
Joined: Thu Jun 24, 2010 8:59 am

Re: Verifying the list-box selected items

Post by dal » Mon Sep 27, 2010 9:08 am

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...