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

<select class="single-option-selector no-select selector single-option-selector-100" 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" 
class="single-option-selector no-select selector single-option-selector-100"> 
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 ?

Hi Thanks a ton for all the the help and support Folks. I was able to resolve this with a lot of guidance from all of you been struggling on this for over 2 days. And here is a working code.

driver = start_firefox(headless=False)                                                                                                                                  
go_to(url)                                                                                                                                                                     
click(Button("Allow All"))  #Need this to accept all cookies                                                                                                   
frame = driver.find_element_by_xpath("//iframe[@id='ba-widget-iframe']")                                                        
driver.switch_to.frame(frame) #need to switch to iframe thingy.                                                                           
driver.find_element_by_css_selector("path").click()  #makes the iframe Modal go away phew finally      
driver.switch_to.parent_frame()  #Now iframe is finally done and dusted go back to main window and do actual meaningful work                               
drop_down = [                                                                                        
    item.web_element                                                                                 
    for item in find_all(                                                                            
        S(".single-option-selector.no-select.selector.single-option-selector-100")                     
    )                                                                                                
][0]                                                                         
select(drop_down, "23.0cm")

                                                                                              
                                                                              
                                                                                                             

                                                             

Thanks a ton for all the help :)

3

There are 3 answers

1
AudioBubble On BEST ANSWER

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")
4
Pallavi On

I would suggest same, switch to iframe, and check synchronization. you can try to record the scenario using selenium ide, and export code to see if that helps.

0
Md. Fazlul Hoque On

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