What is a Headless Browser? Top 5 Headless Browser Tools
Quick overview of new emerging tech of browser automation - what exactly are these tools and how are they used in web scraping?
When web scraping, we often want to retrieve full page source (full HTML of the web page) we can parse it for data using tools like BeautifulSoup. Using Python and Selenium, to get the page source we can use driver.page_source
attribute:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://httpbin.dev/html")
print(driver.page_source)
⚠ It's possible that this command will retrieve page source before the page fully loads if it's a dynamic javascript page. For more see How to wait for page to load in Selenium?
This knowledgebase is provided by Scrapfly — a web scraping API that allows you to scrape any website without getting blocked and implements a dozens of other web scraping conveniences. Check us out 👇