How to get page source in Selenium?

You can easily get the page source in Selenium via the page_source attribute of the Selenium web driver.

Here is some sample code for getting the page source of the ScrapingBee website:

from selenium import webdriver

DRIVER_PATH = '/path/to/chromedriver'
driver = webdriver.Chrome(executable_path=DRIVER_PATH)


# Print page source on screen

Related Selenium web scraping questions: