Data Extraction¶
Methods for extracting information from the page.
get_page_source()¶
Returns the full page HTML as a string.
html = driver.get_page_source()
# Save to file
with open("page.html", "w", encoding="utf-8") as f:
f.write(html)
# Parse with BeautifulSoup
from bs4 import BeautifulSoup
soup = BeautifulSoup(html, "html.parser")
BeautifulSoup is optional
cdriv does not depend on BeautifulSoup. Install separately if needed:
pip install beautifulsoup4
get_title()¶
Returns the page title (content of the <title> tag).