public List withWindow()

in module/geb-core/src/main/groovy/geb/Browser.groovy [739:764]


    public <T> List<T> withWindow(Map options, Closure specification, @DelegatesTo(value = Browser, strategy = DELEGATE_FIRST) Closure<T> block) {
        def anyMatching = false
        def original = currentWindow
        def originalPage = getPage()
        def blockResults = []

        try {
            availableWindows.each {
                switchToWindow(it)
                if (specification.call()) {
                    try {
                        blockResults << doWithWindow(options, block)
                    } finally {
                        anyMatching = true
                    }
                }
            }
        } finally {
            switchToWindow(original)
            page originalPage
        }
        if (!anyMatching) {
            throw new NoSuchWindowException('Could not find a window that would match the specification')
        }
        blockResults
    }