Last active
August 1, 2016 05:08
-
-
Save amirrajan/dd282ad0cafe1a06f1ead4869698f9cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#I "./FSharpModules/UnionArgParser/lib/net40" | |
#I "./FSharpModules/Microsoft.SqlServer.Types/lib/net20" | |
#I "./FSharpModules/FSharp.Data/lib/net40" | |
#I "./FSharpModules/FSharp.Data.SqlClient/lib/net40" | |
#I "./FSharpModules/Http.fs/lib/net40" | |
#I "./FSharpModules/Selenium.WebDriver/lib/net40" | |
#I "./FSharpModules/Selenium.Support/lib/net40" | |
#I "./FSharpModules/SizSelCsZzz/lib" | |
#I "./Fsharpmodules/Newtonsoft.Json/lib/net40" | |
#I "./FSharpModules/canopy/lib" | |
#I "./FsharpModules/Http.fs/lib/net40" | |
#r "UnionArgParser.dll" | |
#r "Microsoft.SqlServer.Types.dll" | |
#r "FSharp.Data.SqlClient.dll" | |
#r "HttpClient.dll" | |
#r "WebDriver.dll" | |
#r "WebDriver.Support.dll" | |
#r "HttpClient.dll" | |
#r "canopy.dll" | |
#r "System.Core.dll" | |
#r "System.Xml.Linq.dll" | |
#r "FSharp.Data.dll" | |
open HttpClient | |
open canopy | |
open runner | |
open System | |
open FSharp.Data | |
open Nessos.UnionArgParser | |
open types | |
open reporters | |
open configuration | |
open OpenQA.Selenium.Firefox | |
open OpenQA.Selenium | |
open OpenQA.Selenium.Support.UI | |
open OpenQA.Selenium.Interactions | |
open System.Collections.ObjectModel | |
let exists selector = | |
let e = someElement selector | |
match e with | |
| Some(e) -> true | |
| _ -> false | |
let clearCookies _ = | |
browser.Manage().Cookies.DeleteAllCookies() | |
let openBrowser _ = | |
configuration.chromeDir <- "./" | |
let options = Chrome.ChromeOptions() | |
options.AddArgument("--enable-logging") | |
options.AddArgument("--v=0") | |
start (ChromeWithOptions options) | |
clearCookies () | |
let ids _ = | |
(js """ | |
return $('[id]').map(function(a) { | |
return $($('[id]')[a]).attr('id'); | |
}) | |
""") :?> ReadOnlyCollection<System.Object> |> List.ofSeq | |
let names _ = | |
(js """ | |
return $('[name]').map(function(a) { | |
return $($('[name]')[a]).attr('name'); | |
}) | |
""") :?> ReadOnlyCollection<System.Object> |> List.ofSeq | |
openBrowser() | |
url "http://chimeclicker.lol.s3-website-us-east-1.amazonaws.com/" | |
let clickity _ = | |
for i in 1 .. 1000 do | |
click "#chimes-button" | |
click "#monster-button" | |
let buyItems _ = | |
elements ".item-left" | |
|> List.rev | |
|> List.map click | |
let buy10xItems _ = | |
elements ".item-buy-5" | |
|> List.rev | |
|> List.map click | |
let buy100xItems _ = | |
elements ".item-buy-20" | |
|> List.rev | |
|> List.map click | |
let buyRightItems _ = | |
elements ".upgrade-image" | |
|> List.rev | |
|> List.map click | |
let clickSpells _ = | |
click ".spell" | |
for i in 1 .. 10 do | |
buyRightItems() |> ignore | |
buyItems() |> ignore | |
buy10xItems() |> ignore | |
buy100xItems() |> ignore | |
clickSpells() |> ignore | |
clickity() |> ignore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You don't need those
ignore
s in the last for loop.