Python Selenium – Error: Element not Interactable. Interactive with website pop up window

  python, selenium

I’m running a web scraper on my company’s website so I can create elements every month. In testing, I have everything working until I get to interact with a pop up menu.

Code that interacts with pop up:

driver.get("www.website.com")
driver.find_element(By.ID, "ButtonCreatePeriod").click()
time.sleep(1)
driver.find_element(By.ID, "NoExpiration").click()
time.sleep(1)
driver.find_element_by_css_selector('[class="k-widget k-dropdown shorterDropDown"]').click()
time.sleep(3)
ddelement2 = driver.find_element_by_xpath("//*[text()='December 2021']")
action2 = ActionChains(driver)
action2.click(on_element=ddelement2).perform()

On action2.click(on_element=ddelement2).perform() I am getting the error:

"Message: element not interactable: [object HTMLLIElement] has no size and location"

I’m guessing this has to do with interacting with the popup.

Within the pop up that is opened with I click "ButtonCreatePeriod" I am opening the drop down menu defined as class="k-widget k-dropdown shorterDropDown".Within this drop down, I need to select the option with the text "December 2021". I cannot use IDs or numerical values here since this varies across other UIs in the website. The options shown on the dropdown are scrollable which could be an issue too.

I used this same code on another UI on the website with no issues but that one did not present a pop up, although it was scrollable.

Any ideas as to how I could have it select "December 2021" here?

Error generated per @cruisepandey suggestion:

Message: element click intercepted: Element <span title="" class="k widget 
k-dropdown shorterDropDown k-state-disabled ic-dropdown-readonly" 
unselectable="on" role="listbox" aria-haspopup="listbox" aria- 
expanded="false" tabindex="0" aria-
owns="MfrCoreTermEffectivePeriodKey_listbox" aria-live="polite" aria-
disabled="false" aria-readonly="true" aria-busy="false" aria-
activedescendant="l581310d-64f8-4bbc-9354-71b6f041d0e3" style="">...
</span> is not clickable at point (434, 383). Other element would 
receive the click: <p>...</p>

(Session info: chrome=93.0.4577.82)`

Source: Python Questions

LEAVE A COMMENT