Site Loader
Auckland, New Zealand
In Selenium there is nothing called WebCombo or WebList class available to select the list box and combo box, every control in UI is called as WebElement, hence to select a combo box or list box from the page we can do in selenium using SelectElement class, which is available under using OpenQA.Selenium.Support.UI namespace. First create an instance of the SelectElement class and then using SelectByText method, select the text from the drop down list box. Here is the code snippet to do so.
SelectElement element = new SelectElement(control);
element.SelectByText(ValueToSelect);
This will now select the drop down or list box value from the UI of the page. Thanks, Karthik KK

Post Author: Karthik kk

One Reply to “Selecting a drop down and list box using selenium”

Leave a Reply to Ajay Cancel reply

Your email address will not be published. Required fields are marked *