     [Answers](https://scrapfly.io/blog)   /  [headless-browser](https://scrapfly.io/blog/tag/headless-browser)   /  [How to get page source in Selenium?](https://scrapfly.io/blog/answers/how-to-get-page-source-in-selenium)   # How to get page source in Selenium?

 by [Bernardas Alisauskas](https://scrapfly.io/blog/author/bernardas) Oct 26, 2022 1 min read [\#headless-browser](https://scrapfly.io/blog/tag/headless-browser) [\#python](https://scrapfly.io/blog/tag/python) [\#selenium](https://scrapfly.io/blog/tag/selenium) 

 [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-get-page-source-in-selenium "Share on LinkedIn")    

 

 

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:

python```python
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?](https://scrapfly.io/blog/answers/how-to-wait-for-page-to-load-in-selenium)



 

    



Scale Your Web Scraping

Anti-bot bypass, browser rendering, and rotating proxies, all in one API. Start with 1,000 free credits.

  No credit card required  1,000 free API credits  Anti-bot bypass included 

 [Start Free](https://scrapfly.io/register) [View Docs](https://scrapfly.io/docs/onboarding) 

 Not ready? Get our newsletter instead. 

 

## Explore this Article with AI

 [ ChatGPT ](https://chat.openai.com/?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-get-page-source-in-selenium) [ Gemini ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-get-page-source-in-selenium) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-get-page-source-in-selenium) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-get-page-source-in-selenium) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-get-page-source-in-selenium) 



 ## Related Articles

 [  

 python headless-browser 

### Web Scraping with Selenium and Python

Introduction to web scraping dynamic javascript powered websites and web apps using Selenium browser automation library ...

 

 ](https://scrapfly.io/blog/posts/web-scraping-with-selenium-and-python) [  

 python headless-browser 

### How To Take Screenshots In Python?

Learn how to take Python screenshots through Selenium and Playwright, including common browser tips and tricks for custo...

 

 ](https://scrapfly.io/blog/posts/how-to-take-screenshots-in-python) [  

 curl 

### How to Use cURL GET Requests

Here's everything you need to know about cURL GET requests and some common pitfalls you should avoid.

 

 ](https://scrapfly.io/blog/posts/how-to-use-curl-get-requests) 

  ## Related Questions

- [ Q How to get page source in Puppeteer? ](https://scrapfly.io/blog/answers/how-to-get-page-source-in-puppeteer)
- [ Q How to save and load cookies in Selenium? ](https://scrapfly.io/blog/answers/how-to-save-and-load-cookies-in-selenium)
- [ Q How to take a screenshot with Selenium? ](https://scrapfly.io/blog/answers/how-to-take-screenshot-with-selenium)
- [ Q How to find elements by XPath in Selenium ](https://scrapfly.io/blog/answers/how-to-find-elements-by-xpath-in-selenium)
 
  



   



 Run headless browsers at scale, **1,000 free credits** [Start Free](https://scrapfly.io/register)