diff --git a/src/canopy/canopy.fs b/src/canopy/canopy.fs index 4ef6b7c3..6290a512 100644 --- a/src/canopy/canopy.fs +++ b/src/canopy/canopy.fs @@ -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 @@ -1039,4 +1042,4 @@ let skip message = (* documented/actions *) let waitForElement cssSelector = - waitFor (fun _ -> someElement cssSelector |> Option.isSome) \ No newline at end of file + waitFor (fun _ -> someElement cssSelector |> Option.isSome)