0

I am wondering if someone can point me in the right direction to get an address search to work. For reference, I am trying to enter an address in the Address Search input box and click the "Search" button on this page: https://beacon.schneidercorp.com/Application.aspx?AppID=44&LayerID=260&PageTypeID=2&PageID=297. A valid address is: "1770 Mobile Ave"

  • This page may or may not load for you, I think it might be using some kind of token. enter image description here

Anyhow, I have tried WebDriverWait with xpath, find_element_by_css_selector, find_element_by_name, etc. to access the input field and then use send_keys but nothing seems to allow me to get past an "ElementNotInteractableException".

My working code starts at the home page and everything here works fine to get to the search page in the picture:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select

options = webdriver.ChromeOptions()
options.headless = True
driver = webdriver.Chrome(options=options)
url = "https://beacon.schneidercorp.com/"
driver.get(url)

select_st = Select(driver.find_element_by_id('stateMenu'))
select_st.select_by_visible_text('Iowa')

select_st = Select(driver.find_element_by_id('areaMenu'))
select_st.select_by_visible_text('Harrison County, IA')

parentElement = driver.find_element_by_class_name('list-group')
elementList = parentElement.find_elements_by_tag_name("a")
elementList[0].click()

You can try to skip the above and start at the search page - I only mention it in case the search page won't load.

Again, some things I have tried to fill out the input include:

address = driver.find_element_by_css_selector('input[placeholder="enter address..."]')
address.send_keys("1770 Mobile Ave")

address = driver.find_element_by_name("ctlBodyPane$ctl01$ctl01$txtAddress")
address.send_keys("1770 Mobile Ave")

address = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, 'ctlBodyPane_ctl01_ctl01_txtAddress')))
address.send_keys("1770 Mobile Ave")

Am I missing something? It seems like the answer here is obvious but I'm overlooking it.

2 Answers 2

1

I have noticed once move to next page from first page one pop up is appeared for terms & condition and you need to click on that first.

Induce WebDriverWait() and wait for element_to_be_clickable()

#click on terms & condition page
WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,"//a[text()='Agree']"))).click()
#Enter data in address field
WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.ID,"ctlBodyPane_ctl01_ctl01_txtAddress"))).send_keys("1770 Mobile Ave")

You need to import below libraries.

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

Let me know how this goes?

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you! That was it! I think stepping through the actual website in the browser, I must have agreed at some point and the page was cached so I didn't know I was supposed to account for it. With your additional line, everything is working and I could proceed to clicking the submit button.
Glad to help you.
1

It worked for me. Using the method find_element_by_xpath(). Other selector that you mentioned was for other elements or incorrect. for example this ctlBodyPane_ctl01_ctl01_txtAddress points the outer element of the search box which is obviously not interactable. Using input[placeholder="enter address..."] this selector you were close but this returns 2 matching elements. To fix this I converted this to xpath and wrapped it for index to return unique matching element.

Here is the part of code fix -

address = driver.find_element_by_xpath('(.//input[@placeholder="enter address..."])[1]') 
address.send_keys("1770 Mobile Ave")

4 Comments

Thank you. I tried that just now, but I'm still getting "ElementNotInteractableException" ...did you use the starting code as well, or just run on search page itself? I wonder if my setup could be part of the problem. I'm using chromedriver 85 and running within a notebook.
I used the code till launching browser and URL, But I supplied the complete URL shared separately above the code. Since main URL was needed login I guess
Okay, thank you very much. From KunduK's comment I see the problem was I didn't agree to the message. So, with that the problem is resolved!
I too had that first I tried with normal mode and then executed on headless mode. while doing it on normal mode I got it and handled it. I thought it wont matter in headless mode and hence not mentioned. Anyways Glad to hear that it worked for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.