Proper Way of Selecting an Option from a Dropdown List
See original GitHub issueHi. What’s the current best way of doing this in protractor tests:
select('orderProp').option('Alphabetical')
for
<select ng-model="orderProp">
<option value="name">Alphabetical</option>
<option value="age">Newest</option>
</select>
This was taken from the tutorial on http://docs.angularjs.org/tutorial/step_04 (last test at the end of the page). I am trying to convert e2e tests to protractor as an exercise and can’t figure out a clean way to select an option from a drop down list. Some examples found on the web seemed too verbose and, perhaps, outdated. Thank you.
Issue Analytics
- State:
- Created 10 years ago
- Comments:16 (2 by maintainers)
Top Results From Across the Web
How to Select Value from DropDown using Selenium ...
Following is a step by step process on how to select value from dropdown in Selenium.
Read more >What are the different ways to select an option from a ...
Your answer · selectByValue(): You can select an option by using Value attribute provided for each option in dropdown menu. · selectByIndex(): ...
Read more >What are the different ways to select an option from ...
We have different ways to select an option from a dropdown using Selenium webdriver. This is done with the help of the Select...
Read more >HTML Select Tag – How to Make a Dropdown Menu or ...
The select tag normally goes within a form element, ... This attribute lets the user select multiple options from the dropdown menu.
Read more >Video: Create and manage drop-down lists - Microsoft Support
Select the cells that you want to contain the lists. · On the ribbon, click DATA > Data Validation. · In the dialog,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I usually do something like:
Worked great! Thank you so much.
Just a recap for others. Until protractor implements a more natural way of selecting an option from a dropdown list, use @khepin method below. This is the cleanest one I’ve found so far.
Given this dropdown:
And I want to select “Newest” option in my spec, do this: