Skip to content

Instantly share code, notes, and snippets.

@matt40k
Created June 4, 2019 15:16
Show Gist options
  • Save matt40k/7102471fa22fa734c0940c73b964ba2a to your computer and use it in GitHub Desktop.
Save matt40k/7102471fa22fa734c0940c73b964ba2a to your computer and use it in GitHub Desktop.
$chromeExe = '"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"'
$outputDir = "C:\Temp\"
function GetScreenshot($fileName, $url)
{
$command = @'
cmd.exe /C $chromeExe --headless --disable-gpu --screenshot="$outputDir\$fileName.png" --window-size=1920,1024 $url
'@
Invoke-Expression -Command:$command
}
GetScreenshot -fileName "test" -url "https://matt40k.co.uk"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment