All Downloads are FREE. Search and download functionalities are using the official Maven repository.

geb.content.NavigableSupport.groovy Maven / Gradle / Ivy

Go to download

Geb (pronounced "jeb") is a browser automation solution. It brings together the power of WebDriver, the elegance of jQuery content selection, the robustness of Page Object modelling and the expressiveness of the Groovy language.

The newest version!
/*
 * Copyright 2010 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package geb.content

import geb.Module
import geb.navigator.Locator
import geb.navigator.Navigator
import geb.navigator.factory.NavigatorFactory
import org.openqa.selenium.By
import org.openqa.selenium.WebDriver.TargetLocator
import org.openqa.selenium.WebElement

class NavigableSupport implements Navigable {

    private final NavigatorFactory navigatorFactory
    private final TargetLocator targetLocator

    NavigableSupport(NavigatorFactory navigatorFactory, TargetLocator targetLocator) {
        this.navigatorFactory = navigatorFactory
        this.targetLocator = targetLocator
    }

    Navigator find() {
        base
    }

    Navigator $() {
        base
    }

    Navigator find(int index) {
        base[index]
    }

    Navigator find(Range range) {
        base[range]
    }

    Navigator $(int index) {
        base[index]
    }

    Navigator $(Range range) {
        base[range]
    }

    Navigator find(String selector) {
        locator.find(selector)
    }

    Navigator $(String selector) {
        locator.find(selector)
    }

    Navigator find(String selector, int index) {
        locator.find(selector, index)
    }

    Navigator find(String selector, Range range) {
        locator.find(selector, range)
    }

    Navigator $(String selector, int index) {
        locator.find(selector, index)
    }

    Navigator $(String selector, Range range) {
        locator.find(selector, range)
    }

    @Override
    Navigator $(Map attributes, By bySelector) {
        locator.find(attributes, bySelector)
    }

    @Override
    Navigator find(Map attributes, By bySelector) {
        locator.find(attributes, bySelector)
    }

    @Override
    Navigator $(Map attributes, By bySelector, int index) {
        locator.find(attributes, bySelector, index)
    }

    @Override
    Navigator find(Map attributes, By bySelector, int index) {
        locator.find(attributes, bySelector, index)
    }

    @Override
    Navigator $(Map attributes, By bySelector, Range range) {
        locator.find(attributes, bySelector, range)
    }

    @Override
    Navigator find(Map attributes, By bySelector, Range range) {
        locator.find(attributes, bySelector, range)
    }

    @Override
    Navigator $(By bySelector) {
        locator.find(bySelector)
    }

    @Override
    Navigator find(By bySelector) {
        locator.find(bySelector)
    }

    @Override
    Navigator $(By bySelector, int index) {
        locator.find(bySelector, index)
    }

    @Override
    Navigator find(By bySelector, int index) {
        locator.find(bySelector, index)
    }

    @Override
    Navigator $(By bySelector, Range range) {
        locator.find(bySelector, range)
    }

    @Override
    Navigator find(By bySelector, Range range) {
        locator.find(bySelector, range)
    }

    Navigator find(Map attributes) {
        locator.find(attributes)
    }

    Navigator $(Map attributes) {
        locator.find(attributes)
    }

    Navigator find(Map attributes, int index) {
        locator.find(attributes, index)
    }

    Navigator find(Map attributes, Range range) {
        locator.find(attributes, range)
    }

    Navigator $(Map attributes, int index) {
        locator.find(attributes, index)
    }

    Navigator $(Map attributes, Range range) {
        locator.find(attributes, range)
    }

    Navigator find(Map attributes, String selector) {
        locator.find(attributes, selector)
    }

    Navigator $(Map attributes, String selector) {
        locator.find(attributes, selector)
    }

    Navigator find(Map attributes, String selector, int index) {
        locator.find(attributes, selector, index)
    }

    Navigator find(Map attributes, String selector, Range range) {
        locator.find(attributes, selector, range)
    }

    Navigator $(Map attributes, String selector, int index) {
        locator.find(attributes, selector, index)
    }

    Navigator $(Map attributes, String selector, Range range) {
        locator.find(attributes, selector, range)
    }

    Navigator $(Navigator[] navigators) {
        navigatorFactory.createFromNavigators(Arrays.asList(navigators))
    }

    Navigator $(WebElement[] elements) {
        navigatorFactory.createFromWebElements(Arrays.asList(elements))
    }

    @Override
    Navigator focused() {
        $(targetLocator.activeElement())
    }

    @Override
     T module(Class moduleClass) {
        base.module(moduleClass)
    }

    @Override
     T module(T module) {
        base.module(module)
    }

    private Navigator getBase() {
        navigatorFactory.base
    }

    private Locator getLocator() {
        navigatorFactory.locator
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy