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

com.redhat.darcy.webdriver.internal.NestedWebDriverElementContext Maven / Gradle / Ivy

Go to download

An implementation of darcy and darcy-web that uses Selenium WebDriver as the automation library backend.

The newest version!
/*
 Copyright 2014 Red Hat, Inc. and/or its affiliates.

 This file is part of darcy-webdriver.

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see .
 */

package com.redhat.darcy.webdriver.internal;

import com.redhat.darcy.ui.api.Locator;
import com.redhat.darcy.ui.api.Transition;
import com.redhat.darcy.ui.api.elements.Element;
import com.redhat.darcy.web.By;
import com.redhat.darcy.webdriver.WebDriverElementContext;

import java.util.List;

public class NestedWebDriverElementContext implements WebDriverElementContext {
    private final Element root;
    private final WebDriverElementContext context;

    public NestedWebDriverElementContext(Element root, WebDriverElementContext context) {
        this.root = root;
        this.context = context;
    }

    @Override
    public Transition transition() {
        return context.transition();
    }

    @Override
    public  List findAllByXPath(Class type, String xpath) {
        return context.findAllByNested(type, root, By.xpath(xpath));
    }

    @Override
    public  T findByXPath(Class type, String xpath) {
        return context.findByNested(type, root, By.xpath(xpath));
    }

    @Override
    public  List findAllByTextContent(Class type, String textContent) {
        return context.findAllByNested(type, root, By.textContent(textContent));
    }

    @Override
    public  T findByTextContent(Class type, String textContent) {
        return context.findByNested(type, root, By.textContent(textContent));
    }

    @Override
    public  List findAllByPartialTextContent(Class type, String partialTextContent) {
        return context.findAllByNested(type, root, By.partialTextContent(partialTextContent));
    }

    @Override
    public  T findByPartialTextContent(Class type, String partialTextContent) {
        return context.findByNested(type, root, By.partialTextContent(partialTextContent));
    }

    @Override
    public  List findAllByChained(Class type, Locator... locators) {
        return context.findAllByNested(type, root, By.chained(locators));
    }

    @Override
    public  T findByChained(Class type, Locator... locators) {
        return context.findByNested(type, root, By.chained(locators));
    }

    @Override
    public  List findAllByNested(Class type, Element parent, Locator child) {
        return context.findAllByNested(type, root, By.nested(parent, child));
    }

    @Override
    public  T findByNested(Class type, Element parent, Locator child) {
        return context.findByNested(type, root, By.nested(parent, child));
    }

    @Override
    public  List findAllByCss(Class type, String css) {
        return context.findAllByNested(type, root, By.css(css));
    }

    @Override
    public  T findByCss(Class type, String css) {
        return context.findByNested(type, root, By.css(css));
    }

    @Override
    public  List findAllByHtmlTag(Class type, String tag) {
        return context.findAllByNested(type, root, By.htmlTag(tag));
    }

    @Override
    public  T findByHtmlTag(Class type, String tag) {
        return context.findByNested(type, root, By.htmlTag(tag));
    }

    @Override
    public  List findAllById(Class type, String id) {
        return context.findAllByNested(type, root, By.id(id));
    }

    @Override
    public  T findById(Class type, String id) {
        return context.findByNested(type, root, By.id(id));
    }

    @Override
    public  List findAllByLinkText(Class type, String linkText) {
        return context.findAllByNested(type, root, By.linkText(linkText));
    }

    @Override
    public  T findByLinkText(Class type, String linkText) {
        return context.findByNested(type, root, By.linkText(linkText));
    }

    @Override
    public  List findAllByName(Class type, String name) {
        return context.findAllByNested(type, root, By.name(name));
    }

    @Override
    public  T findByName(Class type, String name) {
        return context.findByNested(type, root, By.name(name));
    }

    @Override
    public  List findAllByClassName(Class type, String className) {
        return context.findAllByNested(type, root, By.className(className));
    }

    @Override
    public  T findByClassName(Class type, String className) {
        return context.findByNested(type, root, By.className(className));
    }

    @Override
    public  List findAllByAttribute(Class type, String attribute, String value) {
        return context.findAllByNested(type, root, By.attribute(attribute, value));
    }

    @Override
    public  T findByAttribute(Class type, String attribute, String value) {
        return context.findByNested(type, root, By.attribute(attribute, value));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy