# Tested with:
# https://github.com/ultrafunkamsterdam/undetected-chromedriver
# Python 3.9.13
# Windows 10
$pip install a-selenium-iframes-crawler
# Here is one example
from a_selenium_iframes_crawler import Iframes
import undetected_chromedriver as uc
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
if __name__ == "__main__":
driver = uc.Chrome()
driver.get(r"https://testpages.herokuapp.com/styled/iframes-test.html")
getiframes = lambda: Iframes(
driver,
By,
WebDriverWait,
expected_conditions,
seperator_for_duplicated_iframe="Ç",
ignore_google_ads=True,
)
driver.switch_to.default_content()
iframes = getiframes()
for ini,iframe in enumerate(iframes.iframes):
try:
print(f'Frame: {ini} -----------------------------------')
iframes.switch_to(iframe)
elemethods = driver.find_elements(By.CSS_SELECTOR, "*")
print(f"Iframe: {iframe}")
print(f"{repr(elemethods)}...")
except Exception as fe:
print(fe)
continue
Frame: 0 -----------------------------------
Iframe: mainframe
[<undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_10")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_11")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_12")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_13")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_14")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_7")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_15")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_16")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_17")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_18")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_19")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_6")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_20")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_21")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_22")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_8")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_23")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_24")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_25")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_9")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_26")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_27")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_28")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="E59EC81BB56B829F4C631B07079F7C3D_element_29")>]...
Frame: 1 -----------------------------------
Iframe: iframe[id="thedynamichtml"][src="frames/get-list?name=iFrame&list=60"]
[<undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_30")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_31")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_32")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_33")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_34")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_35")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_36")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_37")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_38")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_39")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_40")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_41")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_42")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_43")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_44")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_45")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_46")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_47")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_48")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_49")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_50")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_51")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_52")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_53")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_54")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_55")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_56")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_57")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_58")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_59")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_60")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_61")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_62")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_63")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_64")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_65")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_66")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_67")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_68")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_69")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_70")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_71")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_72")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_73")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_74")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_75")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_76")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_77")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_78")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_79")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_80")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_81")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_82")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_83")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_84")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_85")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_86")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_87")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_88")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_89")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_90")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_91")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_92")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_93")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_94")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_95")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="D7E86C7DC64E97103FAD3F3DCECE57A7_element_96")>]...
Frame: 2 -----------------------------------
Iframe: iframe[id="thedynamichtml"][src="frames/get-list?name=iFrame&list=60"][id="theheaderhtml"][width="100%"][src="frames/frames-header.html"]
[<undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="1BDFDFF5F40BB3C58E167A1E93DE8723_element_97")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="1BDFDFF5F40BB3C58E167A1E93DE8723_element_98")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="1BDFDFF5F40BB3C58E167A1E93DE8723_element_99")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="1BDFDFF5F40BB3C58E167A1E93DE8723_element_100")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="1BDFDFF5F40BB3C58E167A1E93DE8723_element_101")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="1BDFDFF5F40BB3C58E167A1E93DE8723_element_102")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="1BDFDFF5F40BB3C58E167A1E93DE8723_element_103")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="1BDFDFF5F40BB3C58E167A1E93DE8723_element_104")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="1BDFDFF5F40BB3C58E167A1E93DE8723_element_105")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="1BDFDFF5F40BB3C58E167A1E93DE8723_element_106")>, <undetected_chromedriver.webelement.WebElement (session="73089b0db8839d771ef67e37456da934", element="1BDFDFF5F40BB3C58E167A1E93DE8723_element_107")>]...
-
Notifications
You must be signed in to change notification settings - Fork 0
No more pain with iframes ...
License
hansalemaos/a_selenium_iframes_crawler
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
Repository files navigation
About
No more pain with iframes ...