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 or a list of elements. Used in conjunction with
PageFactory
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:
@FindBy(id = "foobar") WebElement foobar;
@FindBy(how = How.ID, using = "foobar") WebElement foobar;
and these two annotations point to the same list of elements:
@FindBy(tagName = "a") List links;
@FindBy(how = How.TAG_NAME, using = "a") List links;
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 © 2012. All Rights Reserved.