Skip to content

Instantly share code, notes, and snippets.

@rflechner
Created December 7, 2016 17:25
Show Gist options
  • Save rflechner/4a0eb72d9d39c7689eda720bd13b33ae to your computer and use it in GitHub Desktop.
Save rflechner/4a0eb72d9d39c7689eda720bd13b33ae to your computer and use it in GitHub Desktop.
#I @"packages\Selenium.WebDriver\lib\net40"
#I @"packages\canopy\lib"
#I @"packages\FAKE\tools\"
#r "FakeLib.dll"
#r "canopy.dll"
#r "WebDriver.dll"
open System
open System.IO
open System.Net
open Fake
open ProcessHelper
open OpenQA.Selenium
open OpenQA.Selenium.Interactions
open canopy
let basePath p =
__SOURCE_DIRECTORY__ @@ p
let seleniumDriversPath = basePath "selenium_drivers"
ensureDirectory seleniumDriversPath
let downloadChromeDriver () =
let zipPath = seleniumDriversPath @@ "chromedriver_win32.zip"
if not <| File.Exists zipPath
then
let client = new WebClient()
let version = client.DownloadString("https://chromedriver.storage.googleapis.com/LATEST_RELEASE").Trim()
let chromeUrl = sprintf "https://chromedriver.storage.googleapis.com/%s/chromedriver_win32.zip" version
client.DownloadFile(chromeUrl, zipPath)
Unzip seleniumDriversPath zipPath
downloadChromeDriver ()
chromeDir <- seleniumDriversPath
start chrome
browser.Manage().Window.Maximize()
url "http://google.fr"
"input[name=q]" << "fsharp"
press enter
nuget "Install" "Canopy" "-OutputDirectory" "packages" "-ExcludeVersion"
nuget "Install" "FAKE" "-OutputDirectory" "packages" "-ExcludeVersion"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment