object BrowserFactory
Companion object to trait BrowserFactory
that holds a UnavailableDriver
object that implements
the Selenium WebDriver
interface by throwing UnsupportedOperationException
. This is
used as a placeholder when a driver is not available on the host platform.
- Source
- BrowserFactory.scala
- Alphabetic
- By Inheritance
- BrowserFactory
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- sealed abstract class GrumpyDriver extends WebDriver
A null-object implementation of the Selenium
WebDriver
interface that throwsUnsupportedOperationException
from all of its methods, used when either 1) aWebDriver
field has not yet been initialized, 2) a requested SeleniumWebDriver
is unavailable on the host platform, or 3) a test that did not declare it needed aWebDriver
in AllBrowserPerSuite or AllBrowserPerTest attempts to use one.A null-object implementation of the Selenium
WebDriver
interface that throwsUnsupportedOperationException
from all of its methods, used when either 1) aWebDriver
field has not yet been initialized, 2) a requested SeleniumWebDriver
is unavailable on the host platform, or 3) a test that did not declare it needed aWebDriver
in AllBrowserPerSuite or AllBrowserPerTest attempts to use one.This is named
GrumpyDriver
because all it does is complain. No matter what you ask of it, it throws anUnsupportedOperationException
back at you. - case class UnavailableDriver(ex: Option[Throwable], errorMessage: String) extends GrumpyDriver with Product with Serializable
An implementation of
WebDriver
that provides an optional exception and an error message and throwsUnsupportedOperationException
from all of its other methods, used when a requested SeleniumWebDriver
is unavailable on the host platform.An implementation of
WebDriver
that provides an optional exception and an error message and throwsUnsupportedOperationException
from all of its other methods, used when a requested SeleniumWebDriver
is unavailable on the host platform.Traits OneBrowserPerSuite, OneBrowserPerTest, AllBrowsersPerTest, and MixedFixtures check if the requested
WebDriver
is available, and if not, installs this driver (to avoid initializing withnull
) and cancels the tests.This is an example of the "Null Object Pattern." We use this pattern to avoid initializing with
null
instead of making the driver type anOption[WebDriver]
for two reasons: 1) the type of the implicit needed by Selenium isWebDriver
, notOption[WebDriver]
, and 2) the Null Object we provide also carries an optional exception and user-friendly error message.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- case object UninitializedDriver extends GrumpyDriver with Product with Serializable
An implementation of
WebDriver
that throwsUnsupportedOperationException
from all of its methods, used to initialize instancevar
s of typeWebDriver
.An implementation of
WebDriver
that throwsUnsupportedOperationException
from all of its methods, used to initialize instancevar
s of typeWebDriver
.Traits OneBrowserPerTest, ConfiguredBrowser, AllBrowsersPerSuite, and AllBrowsersPerTest initialize their
webDriver
field with this value (to avoid initializing withnull
).This is an example of the "Null Object Pattern." We use this pattern to avoid initializing with
null
instead of making the driver type anOption[WebDriver]
for two reasons: 1) the type of the implicit needed by Selenium isWebDriver
, notOption[WebDriver]
, and 2) theUnsupportedOperationException
thrown by the methods of the Null Object we provide carries a user-friendly error message. - case object UnneededDriver extends GrumpyDriver with Product with Serializable
An implementation of
WebDriver
that throwsUnsupportedOperationException
from all of its methods, used when a test does not need a SeleniumWebDriver
at all.An implementation of
WebDriver
that throwsUnsupportedOperationException
from all of its methods, used when a test does not need a SeleniumWebDriver
at all.Traits OneBrowserPerSuite, OneBrowserPerTest, AllBrowsersPerTest, and MixedFixtures check if the requested
WebDriver
is available, and if not, installs this driver (to avoid initializing withnull
) and cancels the tests.This is an example of the "Null Object Pattern." We use this pattern to avoid initializing with
null
instead of making the driver type anOption[WebDriver]
for two reasons: 1) the type of the implicit needed by Selenium isWebDriver
, notOption[WebDriver]
, and 2) theUnsupportedOperationException
thrown by the methods of the Null Object we provide carries a user-friendly error message.
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)