First time here. I've got an issue you might be able to help with. Working on chrome webdriver automation, there's a dropdown menu that's toggled with a click. I need to be able to select list items. Here is the code for the menu.
<button type="button" class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" title="None selected" aria-expanded="true"><span class="multiselect-selected-text">None selected</span> <b class="caret"></b></button> class="multiselect-container dropdown-menu"
My attempts to interact with it through the following have failed.
If you need any more information please ask, not familiar with what might be required. Many thanks
UPDATE; Thanks for the replies. "Select by option name" doesn't seem to work. Using that code with my xpath i get the following
org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "button"
"Select by option value" gives the same error.
I found the xpath and class via css using the chrome selenium IDE, however maybe it's incorrect as the below fails to toggle the dropbox and gives the following error. Also i'm in the correct iframe as i can interact with another element.
driver.findElementByXPath("//button[@type='button']").click(); driver.findElementByCssSelector(".multiselect.dropdown-toggle.btn.btn-default").click(); org.openqa.selenium.ElementNotVisibleException: element not visible
Might i be referencing the element in an incorrect way? Many thanks
update2: I feel like i might be getting close.
driver.findElementById("ptp_sl").click(); unknown error: Element <select class="userdropdown" id="ptp_sl" multiple="multiple">...</select> is not clickable at point