From 283dd1993b16a8e6494fdf4edeac34125ac302b8 Mon Sep 17 00:00:00 2001 From: Chris Holt Date: Sat, 3 Mar 2018 11:10:48 -0600 Subject: [PATCH] Fixed for #405, bad error messages for some actions when browser is null --- src/canopy/canopy.fs | 1 + src/canopy/types.fs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/canopy/canopy.fs b/src/canopy/canopy.fs index 3ff7ed00..3afed3e6 100644 --- a/src/canopy/canopy.fs +++ b/src/canopy/canopy.fs @@ -257,6 +257,7 @@ let rec private findElements cssSelector (searchContext : ISearchContext) : IWeb with | ex -> [] let private findByFunction cssSelector timeout waitFunc searchContext reliable = + if browser = null then raise (CanopyNoBrowserException("Can't perform the action because the browser instance is null. `start chrome` to start a new browser.")) if wipTest then colorizeAndSleep cssSelector try diff --git a/src/canopy/types.fs b/src/canopy/types.fs index 2f2fb26c..1be85e19 100644 --- a/src/canopy/types.fs +++ b/src/canopy/types.fs @@ -32,6 +32,7 @@ type CanopyCheckFailedException(message) = inherit CanopyException(message) type CanopyUncheckFailedException(message) = inherit CanopyException(message) type CanopyReadException(message) = inherit CanopyException(message) type CanopySkipTestException() = inherit CanopyException(String.Empty) +type CanopyNoBrowserException(message) = inherit CanopyException(message) //directions type direction =