     [Answers](https://scrapfly.io/blog)   /  [playwright](https://scrapfly.io/blog/tag/playwright)   /  [How to load local files in Playwright?](https://scrapfly.io/blog/answers/how-to-load-local-files-in-playwright)   # How to load local files in Playwright?

 by [Bernardas Alisauskas](https://scrapfly.io/blog/author/bernardas) Dec 05, 2022 1 min read [\#playwright](https://scrapfly.io/blog/tag/playwright) 

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

 

 

To test our Puppeteer web scrapers we might want o use local files instead of public websites. Just like real web browsers Puppeteer can load local files using the `file://` URL protocol. Here's an example in Python:

python```python
from playwright import sync_playwright

with sync_playwright() as pw:
    browser = pw.chromium.launch(headless=False)
    context = browser.new_context(viewport={"width": 1920, "height": 1080})
    page = context.new_page()

    # open a local file (note: absolute path needs to be used)
    page.goto("file://home/user/projects/test.html");  # linux
    page.goto("file://C:/Users/projects/test.html");  # windows
    print(page.content())
```





 

    



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-load-local-files-in-playwright) [ Gemini ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-load-local-files-in-playwright) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-load-local-files-in-playwright) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-load-local-files-in-playwright) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-load-local-files-in-playwright) 



 ## Related Articles

 [  

 headless-browser 

### How to scrape Local Storage using Headless Browsers

Introduction to scraping local storage - a key value store available in all browsers and used in many modern SPAs - all ...

 

 ](https://scrapfly.io/blog/posts/what-is-local-storage-and-how-to-scrape-it) [     

### How to Use cURL to Download Files

Curlhttps://curl.se/, short for "Client URL," is a versatile command-line tool used for transferring data with URLs. It'...

 

 ](https://scrapfly.io/blog/posts/how-to-curl-download-file) [  

 ai 

### Guide to Local LLMs

Discover the benefits of deploying Local LLMs, from enhanced privacy and reduced latency to tailored AI solutions.

 

 ](https://scrapfly.io/blog/posts/guide-to-local-llm) 

  ## Related Questions

- [ Q How to load local files in Puppeteer? ](https://scrapfly.io/blog/answers/how-to-load-local-files-in-puppeteer)
- [ Q How to wait for page to load in Playwright? ](https://scrapfly.io/blog/answers/how-to-wait-for-page-to-load-in-playwright)
- [ Q How to wait for a page to load in Puppeteer? ](https://scrapfly.io/blog/answers/how-to-wait-for-page-to-load-in-puppeteer)
- [ Q How to download a file with Playwright and Python? ](https://scrapfly.io/blog/answers/how-to-download-file-with-playwright)
 
  



   



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