NavigatorFactory createNavigatorFactory()

in module/geb-core/src/main/groovy/geb/Configuration.groovy [446:461]


    NavigatorFactory createNavigatorFactory(Browser browser) {
        def navigatorFactory = readValue("navigatorFactory", null)
        if (navigatorFactory == null) {
            new BrowserBackedNavigatorFactory(browser, getInnerNavigatorFactory())
        } else {
            if (navigatorFactory instanceof Closure) {
                def result = navigatorFactory.call(browser)
                if (result instanceof NavigatorFactory) {
                    return result
                }
                throw new InvalidGebConfiguration("navigatorFactory returned '${result}', it should be a NavigatorFactory implementation")
            } else {
                throw new InvalidGebConfiguration("navigatorFactory is '${navigatorFactory}', it should be a Closure that returns a NavigatorFactory implementation")
            }
        }
    }