2

I've been trying to search this website 'https://mol.org/regions/?regiontype=countries'. But I keep getting the ElementNotInteractableException. I've tried a lot of methods online but nothing seems to work. Here is my latest approach:

search_query = 'Egypt'
search_bar_XPath = '//div[@class="region-search"]/div/input[1]'

with webdriver as driver:
    wait = WebDriverWait(driver, 10)
    driver.get(url)
    wait.until(presence_of_element_located((By.CLASS_NAME, 'region-search')))
    search_bar = driver.find_element_by_xpath(search_bar_XPath)
    ActionChains(driver).move_to_element(search_bar).click().perform()
    wait.until(EC.element_to_be_clickable((By.XPATH, search_bar_XPath))).send_keys(search_query + Keys.RETURN)
    
    driver.close()

I can't figure out why the search bar is present but yet not interactable nor accessible.

1 Answer 1

1

Your issue looks like with browser screen size :

try this :

driver.maximize_window()

I tried the below code :

driver.maximize_window()
driver.implicitly_wait(30)
driver.get("https://mol.org/regions/?regiontype=countries")
driver.maximize_window()
wait = WebDriverWait(driver, 10)
wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[placeholder='Filter Political boundaries']"))).send_keys('Egypt')
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, it worked & I can proceed to the following page. Appreciate.

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.