0

I am populating a webform online, and wrote a script on selenium to complete this process. When running the code in snippets it works without a problem.

However, when I try to run the full block of code I get "ElementNotInteractableException: element not interactable"

I have narrowed it down to two fields that are triggering this issue, which are vehical_make, and vehival_model. I thought possibly this could be due to the page not loading properly so I added driver.implicitly_wait(10) line, but to no avail the issue persist.

import pandas as pd
import numpy as np
import selenium
from selenium import webdriver 
from selenium.webdriver.common.by import By 
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC 
from selenium.common.exceptions import TimeoutException
option = webdriver.ChromeOptions()
option.add_argument("-headless")
browser = webdriver.Chrome(executable_path=r'C:\Users\GP8535\AppData\Local\Continuum\anaconda3\Conda_folder\Scripts\chromedriver.exe', chrome_options=option)
driver=webdriver.Chrome()
driver.get("https://www.lowestrates.ca/insurance/auto")


# Populate ZipCode field

zipcode=driver.find_element_by_id('postal-code-field').send_keys("M4C 5C6")
element = driver.find_element_by_css_selector('input.btn.secondary').click()


# Vehical Information
vehical_year=driver.find_element_by_id("vehicle-year0").send_keys("2017")
driver.implicitly_wait(10)
vehical_make=driver.find_element_by_id("vehicle-make0").send_keys("CADILLAC")
driver.implicitly_wait(10)                                
vehical_model=driver.find_element_by_id("vehicle-model0").send_keys("XTS 4DR")
vehical_leased=driver.find_element_by_id("is-leased0").send_keys("No")
vehical_purchase_month=driver.find_element_by_id("acquired-month0").send_keys("January")
vehical_purchase_year=driver.find_element_by_id("acquired-year0").send_keys("2018")
daily_distance=driver.find_element_by_id("daily-distance0").send_keys("500")
kilometers_year=driver.find_element_by_id("annual-distance0").send_keys("20")
next_page1=driver.find_element_by_css_selector('button.has-spinner').click()


#Driver Information

first_name=driver.find_element_by_id("first-name0").send_keys("Bob")
dob_month=driver.find_element_by_id("dob-month0").send_keys("May")
dob_day=driver.find_element_by_id("dob-day0").send_keys("11")
dob_year=driver.find_element_by_id("dob-year0").send_keys("1992")

first_insure_year=driver.find_element_by_id("first-insured-year0").send_keys("2009")
time_with_insured=driver.find_element_by_id("time-with-insurer0").send_keys("3")
next_page2=driver.find_element_by_css_selector('button.has-spinner').click()
Bjc51192
  • 327
  • 2
  • 10

0 Answers0