Sometimes, we want to select option in drop down Protractor e2e tests with JavaScript.
In this article, we’ll look at how to select option in drop down Protractor e2e tests with JavaScript.
How to select option in drop down Protractor e2e tests with JavaScript?
To select option in drop down Protractor e2e tests with JavaScript, we can select the select element and then call click
on it.
For instance, we write
element(by.cssContainingText("option", "BeaverBox Testing")).click();
to select the option element that we want to pick with
element(by.cssContainingText("option", "BeaverBox Testing"))
cssContainingText
lets us select by option element’s text content.
Then we call click
on click on the option to select it.
Conclusion
To select option in drop down Protractor e2e tests with JavaScript, we can select the select element and then call click
on it.