I am currently trying to use selenium and BeautifulSoup to retrieve all iframe tags from a website. The problem is I am not getting all the iframes because there are inner h
You can get all the tags exclusively through Selenium with the following code block :
from selenium import webdriver
browser = webdriver.Firefox(executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
browser.get("https://reddit.com")
frames_tag = browser.find_elements_by_tag_name("iframe")
frames_xpath = browser.find_elements_by_xpath("//iframe")
frames_css = browser.find_elements_by_css_selector("iframe")
print("Frames detected through iframe tag are %s" %frames_tag)
print("Frames detected through xpath are %s" %frames_xpath)
print("Frames detected through css are %s" %frames_css)
browser.quit()
The output on my console is :
Frames detected through iframe tag are [, , , , , ]
Frames detected through xpath are [, , , , , ]
Frames detected through css are [, , , , , ]