ide: how to verify the default option selected in a dropdown

4,807 views
Skip to first unread message

lavanya kadiyala

unread,
Mar 28, 2011, 9:56:48 AM3/28/11
to Selenium Users
Hi,
I am using selenium ide.
can somebody tell me how to verify the default option selected in a
dropdown.

I have a dropdown with 5 options. By default the 1st option is
selected.
I want to verify that.

thanks,
Lavanya.

Ambika Rajagopalan

unread,
Mar 28, 2011, 10:41:34 AM3/28/11
to seleniu...@googlegroups.com
you can use the normal select command with the label mentioning the default value


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


Mark Collin

unread,
Mar 28, 2011, 10:47:32 AM3/28/11
to seleniu...@googlegroups.com
You can check to see which option has the selected attribute, or you can get
the text of the one with the selected attribute e.g.

String foo =
Selenium.getText("//select[@id='bar']/option[@selected='selected']");

Regards

Mark

-----Original Message-----
From: seleniu...@googlegroups.com
[mailto:seleniu...@googlegroups.com] On Behalf Of lavanya kadiyala
Sent: 28 March 2011 14:57
To: Selenium Users
Subject: [selenium-users] ide: how to verify the default option selected in
a dropdown

Hi,
I am using selenium ide.
can somebody tell me how to verify the default option selected in a
dropdown.

I have a dropdown with 5 options. By default the 1st option is selected.
I want to verify that.

thanks,
Lavanya.

--


You received this message because you are subscribed to the Google Groups
"Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to
selenium-user...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/selenium-users?hl=en.


--
This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

If you have received this email in error please notify postm...@ardescosolutions.com

lavanya kadiyala

unread,
Mar 28, 2011, 12:00:48 PM3/28/11
to Selenium Users
I have tried the following:

|storeSelectedLabel |
ctl00_ctl00_ctl00_ContentPlaceHolderDefault_QuestContentPlaceHolder_DPMultiSearch_8_SFCNumberDestinations_uxNumOfDest
| y |
|echo | ${y} | |

output: log:
3 Stop Trip
> For more options, visit this group athttp://groups.google.com/group/selenium-users?hl=en.
>
> --
> This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.
>
> If you have received this email in error please notify postmas...@ardescosolutions.com

mam_p

unread,
Mar 28, 2011, 1:32:00 PM3/28/11
to Selenium Users

You need:

verifySelectedIndex | <locator> | <index-of-default-selected-option>

For example:

verifySelectedIndex
//select[@name='topnav']
0

used on www.foothill.edu ensures that the very first option in the
Quick Links drop-down is the one selected.

--mam-p
http://maryannmp.wordpress.com

On Mar 28, 6:56 am, lavanya kadiyala <kadiyalalava...@gmail.com>
wrote:

Long Phuong

unread,
Mar 28, 2011, 4:43:11 PM3/28/11
to seleniu...@googlegroups.com
try:
 
            verifySelectedLabel ( selectLocator, pattern )

 
> Date: Mon, 28 Mar 2011 06:56:48 -0700
> Subject: [selenium-users] ide: how to verify the default option selected in a dropdown
> From: kadiyal...@gmail.com
> To: seleniu...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages