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 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 © 2012. All Rights Reserved.