Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gingeleski/helloworld-headless-chrome-windows
Powershell and Python experiments with headless Chrome on Windows.
https://github.com/gingeleski/helloworld-headless-chrome-windows
headless-chrome powershell python windows
Last synced: 2 days ago
JSON representation
Powershell and Python experiments with headless Chrome on Windows.
- Host: GitHub
- URL: https://github.com/gingeleski/helloworld-headless-chrome-windows
- Owner: gingeleski
- Created: 2018-03-08T05:34:18.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-12T20:12:57.000Z (almost 7 years ago)
- Last Synced: 2024-12-24T01:38:16.640Z (10 days ago)
- Topics: headless-chrome, powershell, python, windows
- Language: Python
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Headless Chrome experiments on Windows
Powershell and Python experiments with headless Chrome.
I thought this might be enlightening for others trying to get started. :rainbow:
This was practice for refactoring [xssmap](https://github.com/gingeleski/xssmap) to leverage headless Chrome.
## Powershell smoke test
```
cd 'C:\Program Files (x86)\Google\Chrome\Application'# Dump DOM to the screen
.\chrome.exe --headless --disable-gpu --enable-logging --dump-dom https://www.google.com/# Save the page as a PDF
.\chrome.exe --headless --disable-gpu --print-to-pdf=C:\Temp\output.pdf https://www.google.com/# Screenshot the page
.\chrome.exe --headless --disable-gpu --screenshot=C:\Temp\screenshot.png https://www.google.com/
```Credit to [this StackOverflow answer](https://stackoverflow.com/questions/45364102/how-do-i-use-headless-chrome-in-chrome-60-on-windows-10). :100:
## Run Python
First [download chromedriver.exe](https://sites.google.com/a/chromium.org/chromedriver/downloads) (>= v2.32) into the repo directory.
Then you can do the following from your prompt... and I recommend doing so [from a venv](https://docs.python.org/3/library/venv.html).
```
pip install -r requirements.txt
python chrome_test.py
```