Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Website and credential variables
- $YourURL = "https://www.gamestop.com/on/demandware.store/Sites-gamestop-us-Site/default/Stores-FindStores?hasCondition=true&hasVariantsAvailableForLookup=true&hasVariantsAvailableForPickup=true&postalCode=90210&source=pdp&showMap=false&radius=100&products=166331%3a1%2c127507%3a1"
- # Invoke Selenium into our script!
- $env:PATH += ";C:\Temp\Selenium\" # Adds the path for ChromeDriver.exe to the environmental variable
- Add-Type -Path "C:\Temp\Selenium\WebDriver.dll" # Adding Selenium's .NET assembly (dll) to access it's classes in this PowerShell session
- $ChromeDriver = New-Object OpenQA.Selenium.Chrome.ChromeDriver # Creates an instance of this class to control Selenium and stores it in an easy to handle variable
- # Make use of Selenium's class methods to manage our browser at will
- $ChromeDriver.Navigate().GoToURL($YourURL) # Browse to the specified website
- # Cleaning up after ourselves!
- Pause
- Function Stop-ChromeDriver {Get-Process -Name chromedriver -ErrorAction SilentlyContinue | Stop-Process -ErrorAction SilentlyContinue}
- $ChromeDriver.Close() # Close selenium browser session method
- $ChromeDriver.Quit() # End ChromeDriver process method
- Stop-ChromeDriver # Function to make double sure the Chromedriver process is finito (double-tap!)And in practice, here is what it does:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement