Skip to content

Commit

Permalink
Better error when browser is null in url function (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
forki authored and lefthandedgoat committed Feb 20, 2017
1 parent b3f6e44 commit 1b9666c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/canopy/canopy.fs
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,10 @@ let on (u: string) =
| ex -> if browser.Url.Contains(u) = false then raise (CanopyOnException(sprintf "on check failed, expected expression '%s' got %s" u browser.Url))

(* documented/actions *)
let ( !^ ) (u : string) = browser.Navigate().GoToUrl(u)
let ( !^ ) (u : string) =
if browser == null then
raise (CanopyOnException "Can't navigate to the given url since the browser is not initialized.")
browser.Navigate().GoToUrl(u)

(* documented/actions *)
let url u = !^ u
Expand Down Expand Up @@ -1039,4 +1042,4 @@ let skip message =

(* documented/actions *)
let waitForElement cssSelector =
waitFor (fun _ -> someElement cssSelector |> Option.isSome)
waitFor (fun _ -> someElement cssSelector |> Option.isSome)

0 comments on commit 1b9666c

Please sign in to comment.