Home > Back-end >  ElementClickInterceptedException: Message: Element <select id because another element <iframe
ElementClickInterceptedException: Message: Element <select id because another element <iframe

Time:04-15

I have a drop down single select combo box. I can get a reference to that drop down via a CSS selector.

<select  data-option="option1" id="product-select-template--15646112383191__main-option-0">
    <option value="15.0cm">15.0cm</option>
    <option value="23.0cm">23.0cm</option>
    <option value="25.0cm">25.0cm</option>
</select>

I tried this

drop_down = [item.web_element for item in find_all(S(".single-option-selector-100"))][0]
select(drop_down, "23.0cm")

And i run into an exception.

    ElementClickInterceptedException: Message: Element 
<select id="product-select-template--15646112383191__main-option-0" 
> 
is not clickable at point (1012,655) because 
another element <iframe id="ba-widget-iframe" src="about:blank"> 
obscures it

Any ideas on how to get over this please ?

CodePudding user response:

First you have to switch to the iframe;

iframe = driver.find_element_by_xpath("//iframe[@id='ba-widget-iframe']")
driver.switch_to.frame(iframe)
drop_down = [item.web_element for item in find_all(S(".single-option-selector-100"))][0]
select(drop_down, "23.0cm")

CodePudding user response:

You are still gettig the same/exact error because of dropdown incorrect selection,I think. You can try this.

frame = driver.find_element_by_xpath("//iframe[@id='ba-widget-iframe']")
driver.switch_to.frame(iframe)


Select(WebDriverWait(driver,20).until(EC.visibility_of_element_located((By.XPATH, "//select[@class='single-option-selector no-select selector single-option-selector-100']")))).select_by_value("15.0cm")


#import
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
  • Related