0
0
Selenium Javatesting~10 mins

@FindBy annotations in Selenium Java - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to locate a web element by its ID using @FindBy.

Selenium Java
@FindBy([1] = "submitBtn")
private WebElement submitButton;
Drag options to blanks, or click blank then click option'
Axpath
Bname
CclassName
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'name' or 'className' when the element is identified by ID.
Using 'xpath' unnecessarily for simple ID selectors.
2fill in blank
medium

Complete the code to locate a web element by its CSS class using @FindBy.

Selenium Java
@FindBy([1] = "login-input")
private WebElement usernameField;
Drag options to blanks, or click blank then click option'
AclassName
Bid
Cname
DtagName
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'id' when the element is identified by class.
Using 'name' or 'tagName' incorrectly.
3fill in blank
hard

Fix the error in the @FindBy annotation to locate an element by its name attribute.

Selenium Java
@FindBy([1] = "password")
private WebElement passwordField;
Drag options to blanks, or click blank then click option'
Aname
Bid
CclassName
Dcss
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'id' or 'className' when the element is identified by name.
Using 'css' which is not a valid attribute in @FindBy.
4fill in blank
hard

Fill both blanks to locate a button element by its tag name and CSS class using @FindBy.

Selenium Java
@FindBy([1] = "button", [2] = "btn-primary")
private WebElement primaryButton;
Drag options to blanks, or click blank then click option'
AtagName
Bid
CclassName
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'id' or 'name' instead of 'tagName' or 'className'.
Mixing up the order of attributes.
5fill in blank
hard

Fill all three blanks to create a @FindBy annotation that locates an input element by tag name, name attribute, and CSS class.

Selenium Java
@FindBy([1] = "input", [2] = "email", [3] = "form-control")
private WebElement emailInput;
Drag options to blanks, or click blank then click option'
AtagName
Bname
CclassName
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'id' instead of 'name' or 'className'.
Mixing up the attribute names.