I am trying to fill out a registration form using Selenium for practice as I am beginning to familiarize myself with this library.
It is the registration form on this website: https://www.fast2sms.com/
What I am currently trying
I start with this:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.fast2sms.com/")
Over there, I click on the signup button with the data-target
attribute set to "#signupM"
using a css selector for the same:
driver.find_element_by_css_selector('button[data-target="#signupM"]').click()
I then set up some dummy values for the fields:
from phone_gen import PhoneNumber
name = "John Doe"
dob = "02-01-1990"
phone_number = PhoneNumber("India").get_number().replace("+91", "")
email_address = f"{phone_number}@mailinator.com"
I wait for the name field, and fill it:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
name_field = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, 'input[name="signup_name"]')))
name_field.send_keys(name)
Then phone number and email address:
phone_number_field = driver.find_element_by_css_selector('input[name="signup_mobile"]')
phone_number_field.send_keys(phone_number)
email_addr_field = driver.find_element_by_css_selector('input[name="signup_email"]')
email_addr_field.send_keys(email_address)
Everything up until here works fine, exactly as expected, but when I try to fill in the Date of Birth field, I face issues:
dob_field = driver.find_element_by_css_selector('input[name="signup_dob"]')
dob_field.send_keys(dob)
Issues I face
- Date of birth field is not filled.
- It throws an error,
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
- I am unable to submit the form with date of birth not filled.
Ways I have tried to debug
- Rechecked the CSS Selector
- Waited for the data-of-birth field to be interactable using WebDriverWait
- Instead of filling in the text, I tried interacting with the popup that shows up when I click the field (I think I have to do this, but don't know how.)
Questions which may seem like duplicates but are not:
Select Particular Date using Python Selenium (Rollover dates)