-1

I am not able to enter & select the DD-MM-YY.

Here the html code...

<div class="col-md-6">
        <div class="form-group">
            <input type="date" class="form-control input_design" name="dob" id="dob"                placeholder="DOB" required>
        </div>
</div>
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

1

As per the HTML the <input> is having the type attribute set as date

<input type="date" class="form-control input_design" name="dob" id="dob" placeholder="DOB" required>

The <input> elements of type="date" create input fields that let the user enter a date, either with a textbox that validates the input or a special date picker interface. As an example:

<input type="date" id="start" name="trip-start" value="2018-07-22"  min="2018-01-01" max="2018-12-31">

Solution

To send a character sequence of type="date" you can use either of the following locator strategies:

  • Using css_selector:

    driver.find_element(By.CSS_SELECTOR, "input.form-control.input_design#dob[name='dob']").send_keys("04-04-2022")
    
  • Using xpath:

    driver.find_element(By.XPATH, "//input[@class='form-control input_design' and @id='dob'][@name='dob']").send_keys("04-04-2022")
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352