Search code examples
c#vb.netseleniumautomation

Selenium select options in multiselect


I have a https://demos.telerik.com/aspnet-mvc/multiselect, and I tried to select options, so as documentation says, I did this:

Dim selectElement As IWebElement = driver.FindElement(By.Id("Supplies"))
Dim selectObject = New SelectElement(selectElement)
selectObject.SelectByValue("value1")

But I get

"OpenQA.Selenium.ElementNotInteractableException: 'Element could not be scrolled into view'"

I tried to add a wait, but I still get the same message. The HTML of multiselect is the following: enter image description here


Solution

  • with c#, I would do something like this:

    Click the button to open the drop down

    then you could use

    driver.FindElement(By.XPath("//select[@id='Supplies']/option[contains(text(), 'test1')]")).click();