How to select value from Drop down if select class is not working

33 views
Skip to first unread message

Rohit Singh

unread,
May 31, 2020, 7:51:29 AM5/31/20
to Selenium Users
Hi,

I have tried to select a value from the drop-down and I am not able to select a value . I am using the Page object model.

Code:- First I have to click on Select Frequency then select monthly or daily

Test code.png


Josh Abrahamsen

unread,
Jun 1, 2020, 9:26:34 PM6/1/20
to seleniu...@googlegroups.com
Don't use select value, treat the items in the drop-down as if they were any other element on a page. As you mentioned, just click the drop-down then click the item in the drop down menu. Not all drop down menus are created equal.

Select value refers to drop down menus that actually have value tags, at least to my knowledge. In your case they're just span tags so click the span that contains the text you're looking for. Hope this helps.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/d96c445e-fd18-431b-b72d-ab19d304eaa1%40googlegroups.com.

Hanumantha Reddy

unread,
Jun 2, 2020, 6:30:01 AM6/2/20
to Selenium Users
Hey Rohith,
It is not a "Select" tag to use SelectElement. These type of dropdowns are made from CSS frameworks like Bootstrap. They use a dropdown widget. You should treat each options as HTML elements. 
You can get more details on how to handle such dropdowns from below video,

Rohit Singh

unread,
Jun 2, 2020, 8:14:55 AM6/2/20
to Selenium Users
Thank for reply

On Tuesday, June 2, 2020 at 6:56:34 AM UTC+5:30, Josh Abrahamsen wrote:
Don't use select value, treat the items in the drop-down as if they were any other element on a page. As you mentioned, just click the drop-down then click the item in the drop down menu. Not all drop down menus are created equal.

Select value refers to drop down menus that actually have value tags, at least to my knowledge. In your case they're just span tags so click the span that contains the text you're looking for. Hope this helps.

On Sun, May 31, 2020, 6:51 AM Rohit Singh <rohitc...@gmail.com> wrote:
Hi,

I have tried to select a value from the drop-down and I am not able to select a value . I am using the Page object model.

Code:- First I have to click on Select Frequency then select monthly or daily

Test code.png


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seleniu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages