Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#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