

If you are unfamiliar with Selenium WebDriver, you should check out the Selenium site.įollow these steps to setup your tests for running with ChromeDriver:Įnsure Chromium/Google Chrome is installed in a recognized locationĬhromeDriver expects you to have Chrome installed in the default location for your platform. It is maintained by the Chromium team with help from WebDriver contributors. $modulePath = ($env:psmodulepath -split " ")+"\Selenium\3.0.ChromeDriver is a separate executable that Selenium WebDriver uses to control Chrome. $fileName = "C:\temp\chromedriver_win32.zip" #Extract the exe to the appropriate PSModule Selenium directory. Invoke-WebRequest -Uri $fullURL -OutFile $fileName -UseBasicParsing

#Download the latest ChromeDriver release available for our version of Chrome. $rel = Invoke-WebRequest $latestRelease -UseBasicParsing

#Find the latest ChromeDriver release for our version of Chrome. #Chrome Version XX - Only show the first two numbers. $ver = (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo.ProductVersion 'Running PowerShell with Full Privileges' Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "" -elevated' -f ($myinvocation.M圜ommand.Definition)) # tried to elevate, did not work, aborting $currentUser = New-Object $(::GetCurrent()) I hope this helps someone! I've learned so much through r/powershell, I'd love to give back! I created this script to get the current version of chrome installed and download the associated chromedriver for selenium.

I have match up the chrome driver with the version installed on my computer which is a little tedious. New to scripting, but this made me proud! I started building Selenium scripts that run on a daily basis, but once Chrome auto-updates, the script bombs out.
