org.jboss.arquillian.graphene.GrapheneElement Maven / Gradle / Ivy
/**
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.arquillian.graphene;
import java.util.List;
import org.jboss.arquillian.graphene.spi.ImplementedBy;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.internal.Locatable;
import org.openqa.selenium.internal.WrapsElement;
/**
*
* Interface for Graphene extensions of {@link WebElement}.
*
*
*
* Following methods are provided over the {@link WebElement} interface:
*
*
*
* - {@link #isPresent()}
* - {@link #findGrapheneElements(By)}
*
*
*
* Important: {@link GrapheneElementImpl} is not intended for extension, do not subclass it. The
* {@link GrapheneElementImpl} might become abstract class or interface in the future. It can't be final because then it couldn't be
* proxied by Graphene.
*
*
* @author Jan Papousek
*/
@ImplementedBy(className = "org.jboss.arquillian.graphene.GrapheneElementImpl")
public interface GrapheneElement extends WebElement, Locatable, WrapsElement {
/**
*
* Returns true if this element is present in the page
*
*
*
* Note: WebDriver generally does not need this method since their elements are traditionally returned by calls as
* {@link SearchContext#findElement(By)}. However Graphene de-references elements in time of call, and the object exposed
* publicly is just an proxy object. In that case we can call any method on that object which can lead into
* {@link NoSuchElementException}. To prevent this behavior, you should first check that the element is present in the page
* using this method.
*
*
* @return true if this element is present in the page
*/
boolean isPresent();
/**
* This method is alternative to {@link #findElements(By)}, but it returns list of type {@link GrapheneElement}.
*
* @return list of elements
*
* @see WebElement#findElement(By)
*/
List findGrapheneElements(By by);
/**
* Overriden version of WebElement.findBy()
method.
*
* @return GrapheneElement
*
* @see WebElement#findElement(By)
*/
GrapheneElement findElement(By by);
}