org.openqa.selenium.support
Annotation Type FindBy


@Retention(value=RUNTIME)
@Target(value=FIELD)
public @interface FindBy

Used to mark a field on a Page Object to indicate an alternative mechanism for locating the element. Used in conjunction with org.openqa.selenium.support.PageFactory#proxyElement(org.openqa.selenium.WebDriver, Object, java.lang.reflect.Field) this allows users to quickly and easily create PageObjects.

You can either use this annotation by specifying both "how" and "using" or by specifying one of the location strategies (eg: "id") with an appropriate value to use. Both options will delegate down to the matching By methods in By class. For example, these two annotations point to the same element:


Optional Element Summary
 String className
           
 String css
           
 How how
           
 String id
           
 String linkText
           
 String name
           
 String partialLinkText
           
 String tagName
           
 String using
           
 String xpath
           
 

how

public abstract How how
Default:
org.openqa.selenium.support.How.ID

using

public abstract String using
Default:
""

id

public abstract String id
Default:
""

name

public abstract String name
Default:
""

className

public abstract String className
Default:
""

css

public abstract String css
Default:
""

tagName

public abstract String tagName
Default:
""

linkText

public abstract String linkText
Default:
""

partialLinkText

public abstract String partialLinkText
Default:
""

xpath

public abstract String xpath
Default:
""


Copyright © 2011. All Rights Reserved.