Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error when browser is null in url function #348

Merged
merged 1 commit into from
Feb 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)