[Python] selenium-webdriver: select not working in Firefox 47

Discussão em 'Python' iniciado por Stack, Abril 6, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to select an option in a select form on a website with Selenium.

    It used to work fine, but after upgrading Selenium and Firefox and switching to the Marionette Webdriver to make the upgrade work, my code doesn't work anymore.

    The desired form gets selected and the code doesn't raise an exception (which it does if I give a wrong option), but the option doesn't actually get selected.

    my Python code:

    from selenium.webdriver.support.ui import Select
    select = Select(driver.find_element_by_id("casetype_345"))
    select.select_by_visible_text("1")


    the corresponding html code:

    <select id="casetype_345" class="nat_casetypelist_casetype" name="casetype_345" style="float: left;">
    <option value="0" selected="">0</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>


    I tried to select.select_by_value which doesn't change anything and select.deselect_all() before selecting the option which raises an exception.

    Continue reading...

Compartilhe esta Página