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

com.redhat.darcy.webdriver.internal.ChainedWebDriverElementContext 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 ChainedWebDriverElementContext implements WebDriverElementContext {
    private final Locator parent;
    private final WebDriverElementContext context;

    public ChainedWebDriverElementContext(Locator parent, WebDriverElementContext context) {
        this.parent = parent;
        this.context = context;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy