org.seleniumhq.selenium.fluent
Class FluentBy

java.lang.Object
  extended by org.openqa.selenium.By
      extended by org.seleniumhq.selenium.fluent.FluentBy
Direct Known Subclasses:
FluentBy.ByAttribute

public abstract class FluentBy
extends org.openqa.selenium.By

Mechanism used to locate elements within a document. In order to create your own locating mechanisms, it is possible to subclass this class and override the protected methods as required, though it is expected that that all subclasses rely on the basic finding mechanisms provided through static methods of this class:

public WebElement findElement(WebDriver driver) { WebElement element = driver.findElement(By.id(getSelector())); if (element == null) element = driver.findElement(By.name(getSelector()); return element; }


Nested Class Summary
static class FluentBy.ByAttribute
           
static class FluentBy.NotByAttribute
           
 
Nested classes/interfaces inherited from class org.openqa.selenium.By
org.openqa.selenium.By.ByClassName, org.openqa.selenium.By.ByCssSelector, org.openqa.selenium.By.ById, org.openqa.selenium.By.ByLinkText, org.openqa.selenium.By.ByName, org.openqa.selenium.By.ByPartialLinkText, org.openqa.selenium.By.ByTagName, org.openqa.selenium.By.ByXPath
 
Constructor Summary
FluentBy()
           
 
Method Summary
static FluentBy.ByAttribute attribute(String name)
          Finds elements by the presence of an attribute name irrespective of element name.
static FluentBy.ByAttribute attribute(String name, String value)
          Finds elements by an named attribute matching a given value, irrespective of element name.
 void beforeFindElement(org.openqa.selenium.WebDriver driver)
           
static org.seleniumhq.selenium.fluent.FluentBy.ByComposite composite(org.openqa.selenium.By.ByTagName b0, org.openqa.selenium.By.ByClassName b1)
          Finds elements a composite of other By strategies
static org.seleniumhq.selenium.fluent.FluentBy.ByComposite composite(org.openqa.selenium.By.ByTagName b0, FluentBy.ByAttribute b1)
           
static org.seleniumhq.selenium.fluent.FluentBy.ByLast last()
           
static org.seleniumhq.selenium.fluent.FluentBy.ByLast last(org.openqa.selenium.By by)
           
static FluentBy.ByAttribute notAttribute(String name)
          Finds elements by an named attribute not being present in the element, irrespective of element name.
static org.seleniumhq.selenium.fluent.FluentBy.ByStrictClassName strictClassName(String className)
          Finds elements based on the value of the "class" attribute.
 
Methods inherited from class org.openqa.selenium.By
className, cssSelector, equals, findElement, findElements, hashCode, id, linkText, name, partialLinkText, tagName, toString, xpath
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FluentBy

public FluentBy()
Method Detail

beforeFindElement

public void beforeFindElement(org.openqa.selenium.WebDriver driver)

strictClassName

public static org.seleniumhq.selenium.fluent.FluentBy.ByStrictClassName strictClassName(String className)
Finds elements based on the value of the "class" attribute. If the second param is set to true, if an element has many classes then this will match against each of them. For example if the value is "one two onone", then the following "className"s will match: "one" and "two"

Parameters:
className - The value of the "class" attribute to search for
Returns:
a By which locates elements by the value of the "class" attribute.

attribute

public static FluentBy.ByAttribute attribute(String name)
Finds elements by the presence of an attribute name irrespective of element name. Currently implemented via XPath.


attribute

public static FluentBy.ByAttribute attribute(String name,
                                             String value)
Finds elements by an named attribute matching a given value, irrespective of element name. Currently implemented via XPath.


notAttribute

public static FluentBy.ByAttribute notAttribute(String name)
Finds elements by an named attribute not being present in the element, irrespective of element name. Currently implemented via XPath.


composite

public static org.seleniumhq.selenium.fluent.FluentBy.ByComposite composite(org.openqa.selenium.By.ByTagName b0,
                                                                            org.openqa.selenium.By.ByClassName b1)
Finds elements a composite of other By strategies


composite

public static org.seleniumhq.selenium.fluent.FluentBy.ByComposite composite(org.openqa.selenium.By.ByTagName b0,
                                                                            FluentBy.ByAttribute b1)

last

public static org.seleniumhq.selenium.fluent.FluentBy.ByLast last(org.openqa.selenium.By by)

last

public static org.seleniumhq.selenium.fluent.FluentBy.ByLast last()


Copyright © 2013. All Rights Reserved.