Skip to content

Commit

Permalink
1.4.5 added ability to shiftClick
Browse files Browse the repository at this point in the history
  • Loading branch information
lefthandedgoat committed Jun 9, 2017
1 parent 8001789 commit 5915f46
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
5 changes: 4 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,4 +345,7 @@ Update to Selenium 3.3 [Issue #351](https://github.com/lefthandedgoat/canopy/iss
* Added a json validator [PR #368](https://github.com/lefthandedgoat/canopy/pull/368)

#### 1.4.3 - June 1 2017
* json validator - null arrays and properties are now acceptable
* json validator - null arrays and properties are now acceptable

#### 1.4.5 - June 9 2017
* Added ability to shiftClick
9 changes: 9 additions & 0 deletions docs/content/actions.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ ctrlClick "#list > option"
ctrlClick "Oklahoma"
ctrlClick (element "#list > option")

(**
shiftClick
-----
Click an element via selector or text while holding down the shift key, can also click selenium `IWebElements`.
*)
shiftClick "#list > option"
shiftClick "Oklahoma"
shiftClick (element "#list > option")

(**
rightClick
-----
Expand Down
8 changes: 4 additions & 4 deletions src/canopy/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ open System.Reflection
[<assembly: AssemblyTitleAttribute("canopy")>]
[<assembly: AssemblyProductAttribute("canopy")>]
[<assembly: AssemblyDescriptionAttribute("F# web testing framework")>]
[<assembly: AssemblyVersionAttribute("1.4.3")>]
[<assembly: AssemblyFileVersionAttribute("1.4.3")>]
[<assembly: AssemblyVersionAttribute("1.4.5")>]
[<assembly: AssemblyFileVersionAttribute("1.4.5")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "canopy"
let [<Literal>] AssemblyProduct = "canopy"
let [<Literal>] AssemblyDescription = "F# web testing framework"
let [<Literal>] AssemblyVersion = "1.4.3"
let [<Literal>] AssemblyFileVersion = "1.4.3"
let [<Literal>] AssemblyVersion = "1.4.5"
let [<Literal>] AssemblyFileVersion = "1.4.5"
12 changes: 12 additions & 0 deletions src/canopy/canopy.fs
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,18 @@ let ctrlClick item =
true))
| _ -> raise (CanopyNotStringOrElementException(sprintf "Can't ctrlClick %O because it is not a string or webelement" item))

(* documented/actions *)
let shiftClick item =
let actions = Actions(browser)

match box item with
| :? IWebElement as elem -> actions.KeyDown(Keys.Shift).Click(elem).KeyUp(Keys.Shift).Perform() |> ignore
| :? string as cssSelector ->
wait elementTimeout (fun _ -> ( let elem = element cssSelector
actions.KeyDown(Keys.Shift).Click(elem).KeyUp(Keys.Shift).Perform()
true))
| _ -> raise (CanopyNotStringOrElementException(sprintf "Can't shiftClick %O because it is not a string or webelement" item))

(* documented/actions *)
let rightClick item =
let actions = Actions(browser)
Expand Down
2 changes: 2 additions & 0 deletions src/canopy/csharp.fs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ type canopy () =

static member ctrlClick selector = ctrlClick selector

static member shiftClick selector = shiftClick selector

static member rightClick selector = rightClick selector

static member check selector = check selector
Expand Down

0 comments on commit 5915f46

Please sign in to comment.