WebDriverWait(driver,10).until(EC.frame_to_be_available_and_switch_to_it((By.XPATH,'//[@id="dataviscontainer"]/div/iframe')))
span_texts = [item.text for item in driver.find_elements_by_css_selector('span')]
print(span_texts)
My objective here is to scrape text from multiple span tags which actually are in dropdown list which is inside a iframe & the iframe does not have any name class or id so I used the XPath. After running this code I get an empty list. below are 2 span tags that has the text
<span class="slicerText" title="Albury (C)" style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-style: solid; border-color: rgb(96, 94, 92); border-width: 0px; font-size: 13.3333px; font-family: Arial; line-height: 17px;">Albury (C)</span>
<span class="slicerText" title="Armidale Regional (A)" style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-style: solid; border-color: rgb(96, 94, 92); border-width: 0px; font-size: 13.3333px; font-family: Arial; line-height: 17px;">Armidale Regional (A)</span>