I want to select and de-select the drop down list using webdriverjs. Currently, my code looks like -

<select id="VISA-expiryMonth" name="expiryMonth" class="select expiryMonth">
        <option value="" selected="selected"></option>
        <option value="01">01</option>
        <option value="02">02</option>
        <option value="03">03</option>
        <option value="04">04</option>
        <option value="05">05</option>
        <option value="06">06</option>
        <option value="07">07</option>
        <option value="08">08</option>
        <option value="09">09</option>
        <option value="10">10</option>
        <option value="11">11</option>
        <option value="12">12</option>

And to select -

await driver.findElement(By.id('VISA-expiryMonth')).sendKeys("01");

To De-select -

await driver.findElement(By.id('VISA-expiryMonth')).sendKeys("");

(just the blank quote)

This only works fine(clears the input) on Safari but not on Chrome or Firefox.

0 Answers