I'm trying to scrap dynamic content from a Blog through Selenium but it always returns un rendered JavaScript.
To test this behavior I tried to wait till iframe loads completely and printed it's content which prints fine but again when I move back to parent frame it just displays un rendered JavaScript.
I'm looking for something in which I'm able to print completely rendered HTML content
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
driver = webdriver.Chrome("path to chrome driver")
driver.get('http://justgivemechocolateandnobodygetshurt.blogspot.com/')
WebDriverWait(driver, 40).until(expected_conditions.frame_to_be_available_and_switch_to_it((By.ID, "navbar-iframe")))
# Rendered iframe HTML is printed.
content = driver.page_source
print content.encode("utf-8")
# When I switch back to parent frame it again prints non rendered JavaScript.
driver.switch_to.parent_frame()
content = driver.page_source
print content.encode("utf-8")
.page_sourcereturns the source, not the DOMfind_elementmethods?find_element*commands should do