Skip to content

Instantly share code, notes, and snippets.

@rayterrill
Last active November 1, 2016 23:22
Show Gist options
  • Save rayterrill/828e9977c22154eef0a66363b718b737 to your computer and use it in GitHub Desktop.
Save rayterrill/828e9977c22154eef0a66363b718b737 to your computer and use it in GitHub Desktop.
#requires that you have the .NET selenium webdriver installed http://selenium-release.storage.googleapis.com/3.0/selenium-dotnet-3.0.0.zip
#as well as the Chrome driver: https://sites.google.com/a/chromium.org/chromedriver/
#installed both of mine into C:\wip\selenium\net35
Set-Location C:\wip\selenium\net35
# Import the Selenium DLLs
Add-Type -Path "C:\wip\selenium\net35\Selenium.WebDriverBackedSelenium.dll"
Add-Type -Path "C:\wip\selenium\net35\ThoughtWorks.Selenium.Core.dll"
Add-Type -Path "C:\wip\selenium\net35\WebDriver.dll"
Add-Type -Path "C:\wip\selenium\net35\WebDriver.Support.dll"
$driver = New-Object OpenQA.Selenium.Chrome.ChromeDriver
$driver.Navigate().GoToUrl("https://mysearchsite.sharepoint.com/")
$searchField = $driver.findElementsByXpath("//input[@title='Search...']")
$searchField.SendKeys("test")
$submitButton = $driver.findElementsByXpath("//a[@title='Search']").click()
$driver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment