I have to select an option from a dropdown menu, the HTML code is
<select id="formIdVeic" style="width: 250px; display: none;" class="combobox-f combo-f" comboname="formIdVeic"> <option value="" selected="selected"></option> <option value="E">TARGA ESTERA </option> <option value="J">TARGA FILOBUS </option> <option value="L">TELAIO </option> <option value="TN" selected="selected">TARGA ITALIANA NUOVO FORMATO </option> <option value="TS">TARGA ITALIANA SPECIALE </option> <option value="TV">TARGA ITALIANA VECCHIO FORMATO </option> <option value="X">TARGA PROVA </option> <option value="Y">TARGA PROVVISORIA </option> </select>
I want to select the "TV" option. The solution I've come to is
from selenium.webdriver.support.select import Select ... a=Select(browser.find_element_by_xpath('//select[@id="formIdVeic"]')) a.select_by_visible_text("TARGA ITALIANA VECCHIO FORMATO").click()
or
a.select_by_value("TV").click()
where browser is a web browser driver. Both the solutions return an exception:
ElementNotVisibleException: element not visible: Element is not currently visible and may not be manipulated
Where am I doing wrong?
<span class="combo" style="width: 248px;"> <input type="text" class="combo-text validatebox-text" autocomplete="off" readonly="readonly" style="width: 230px;"> <span> <span class="combo-arrow"> </span> </span> <input type="hidden" class="combo-value" name="formIdVeic" value="TN"> </span>
. What can I do with this?