I have made a code which should automatically add a contact to Google Contacts. I'm on it's last stage but due to pop up of a modal box everything changes.
from selenium import webdriver
from time import sleep
fname="Misuzu"
lname="Fusuzu"
number=987654321
driver=webdriver.Chrome()
driver.get('https://contacts.google.com/')
email=driver.find_element_by_id("identifierId")
email.send_keys('abc@gmail.com')
psw='123456789'
submit=driver.find_element_by_id("identifierNext")
submit.click()
sleep(2)
password=driver.find_element_by_name("password")
password.send_keys(psw)
submit=driver.find_element_by_id("passwordNext")
submit.click()
sleep(2)
create_contact=driver.find_element_by_xpath("//div[@class='aU2Vdf'][button/@class='VfPpkd-BIzmGd VfPpkd-BIzmGd-OWXEXe-X9G3K bgpk6e']")
create_contact.click()
sleep(10)
#This is the part frome where my code stops working and raises the element not interactable error inspite of it being the part where I need to input my name.
driver.switch_to.active_element
fnameins=driver.find_element_by_xpath("//div[@class='x3wWge'][//div[@class='Xb9hP'][input/@class='whsOnd zHQkBf']]")
fnameins.click()
lnameins=driver.find_element_by_xpath("//input[@class='whsOnd zHQkBf']")
lnameins.send_keys(lname)
numins=driver.find_element_by_xpath("//input[@class='whsOnd zHQkBf']")
numins.send_keys(number)
save=driver.find_element_by_xpath("//input[@class='VfPpkd-vQzf8d']")
save.click()
sleep(2)
driver.quit()