Skip to content

Instantly share code, notes, and snippets.

@betillogalvanfbc
Last active January 31, 2021 23:30
Show Gist options
  • Save betillogalvanfbc/3aca8d1397a233208fafb039ee148419 to your computer and use it in GitHub Desktop.
Save betillogalvanfbc/3aca8d1397a233208fafb039ee148419 to your computer and use it in GitHub Desktop.
SimpleScreenshotPowershell.ps1
#More-Information With Powershell
#https://tech.mavericksevmont.com/blog/powershell-selenium-automate-web-browser-interactions-part-i/
foreach($hosti in Get-Content "hosts.txt"){
$YourURL = "https://www.$hosti"
$regxphoto = $hosti -replace "com$", "png"
$env:PATH += ";C:\path\chromedriver_win32\"
Add-Type -Path "C:\path\chromedriver_win32\WebDriver.dll"
$ChromeDriver = New-Object OpenQA.Selenium.Chrome.ChromeDriver
$ChromeDriver.Navigate().GoToURL($YourURL)
$ChromeDriver.GetScreenshot().SaveAsFile("$regxphoto")
$ChromeDriver.Quit()
Start-Sleep -s 1
}
Measure-Command {echo $_ | Write-Host}
#Show Time Execute
Write-Output $_ | Measure-Command -Expression { 0..25000 | ForEach-Object { $arr += $_ }} | Format-Table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment