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
 java.lang.String className
           
 java.lang.String css
           
 How how
           
 java.lang.String id
           
 java.lang.String linkText
           
 java.lang.String name
           
 java.lang.String partialLinkText
           
 java.lang.String tagName
           
 java.lang.String using
           
 java.lang.String xpath
           
 

how

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

using

public abstract java.lang.String using
Default:
""

id

public abstract java.lang.String id
Default:
""

name

public abstract java.lang.String name
Default:
""

className

public abstract java.lang.String className
Default:
""

css

public abstract java.lang.String css
Default:
""

tagName

public abstract java.lang.String tagName
Default:
""

linkText

public abstract java.lang.String linkText
Default:
""

partialLinkText

public abstract java.lang.String partialLinkText
Default:
""

xpath

public abstract java.lang.String xpath
Default:
""


Copyright © 2011. All Rights Reserved.