1
<iframe id="xyz" src="https://www.XXXXXX.com/" allowfullscreen="yes" style="width: 100%; height: 100%;">
    #document
        <!DOCTYPE html>
        <html>...</html>  // a whole new HTML document
</iframe>

I tried the below code, but I am not able to access the inner HTML content. Please guide.

docu=driver.find_element_by_xpath("//*[@id='asdfghg']").find_element_by_tag_name("iframe")
print(docu.get_attribute("innerHTML"))
  • Does this answer your question? [NoSuchElementException, Selenium unable to locate element](https://stackoverflow.com/questions/48471321/nosuchelementexception-selenium-unable-to-locate-element) – Sers Jan 12 '20 at 16:23
  • What is the error? – Muzzamil Jan 12 '20 at 19:14

1 Answers1

1

Not sure if you are particular to an element or need full source , check and upvote if below lines can help you...

from selenium import webdriver
driver = webdriver.Chrome(executable_path="C:\\driver\\chromedriver.exe")
driver.get('https://yoururl')

# HTML Source before getting in frame
print(driver.page_source)
# Switch to Frame
driver.switch_to.frame('yourframeID')
# HTML Source after getting in frame
print(driver.page_source)
Hietsh Kumar
  • 1,197
  • 9
  • 17