Last active
January 31, 2021 23:30
-
-
Save betillogalvanfbc/3aca8d1397a233208fafb039ee148419 to your computer and use it in GitHub Desktop.
SimpleScreenshotPowershell.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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