-3

How to get selected HTML dropdown value in protractor selenium? It's printing all dropdown values instead of selected value.
I have tried the following ways:

  • option:selected
  • option:clicked
  • option.getFirstSelectedvalue()

None of these worked.

Can someone help me with the issue?

Mani
  • 1
  • 3
  • Questions seeking debugging help ("**Why isn't this code working?**") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it **in the question itself**. Questions without **a clear problem statement** are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example.](https://stackoverflow.com/help/mcve) – undetected Selenium May 29 '18 at 13:04
  • Possible duplicate of [Select -> option abstraction](https://stackoverflow.com/questions/28723419/select-option-abstraction) – JeffC May 29 '18 at 16:20

1 Answers1

0

If your dropdown implement by HTML Tag: <select> and <option>, you can use css selector: element(by.css('option:checked')

yong
  • 13,357
  • 1
  • 16
  • 27