Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. # Website and credential variables
  2. $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"
  3. # Invoke Selenium into our script!
  4. $env:PATH += ";C:\Temp\Selenium\" # Adds the path for ChromeDriver.exe to the environmental variable
  5. Add-Type -Path "C:\Temp\Selenium\WebDriver.dll" # Adding Selenium's .NET assembly (dll) to access it's classes in this PowerShell session
  6. $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
  7.  
  8. # Make use of Selenium's class methods to manage our browser at will
  9. $ChromeDriver.Navigate().GoToURL($YourURL) # Browse to the specified website
  10.  
  11. # Cleaning up after ourselves!
  12. Pause
  13. Function Stop-ChromeDriver {Get-Process -Name chromedriver -ErrorAction SilentlyContinue | Stop-Process -ErrorAction SilentlyContinue}
  14. $ChromeDriver.Close() # Close selenium browser session method
  15. $ChromeDriver.Quit() # End ChromeDriver process method
  16. 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