I use selenium to go to the desired web page and then analyze it with Beautiful Soup .
Someone showed how to get an internal HTML element in Selenium WebDriver . Is there a way to get the HTML of the whole page? thanks
Python code example (Judging by the post above, the language does not seem to matter much):
from selenium import webdriver from selenium.webdriver.support.ui import Select from bs4 import BeautifulSoup url = 'http://www.google.com' driver = webdriver.Firefox() driver.get(url) the_html = driver---somehow----.get_attribute('innerHTML') bs = BeautifulSoup(the_html, 'html.parser')
source share