0
0
Selenium Javatesting~10 mins

Action methods per page 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 click the login button using the correct method.

Selenium Java
public void clickLogin() {
    loginButton.[1]();
}
Drag options to blanks, or click blank then click option'
Aclick
BsendKeys
Csubmit
Dclear
Attempts:
3 left
💡 Hint
Common Mistakes
Using sendKeys() to click a button instead of click()
Using clear() which is for input fields, not buttons
2fill in blank
medium

Complete the code to enter text into the username field.

Selenium Java
public void enterUsername(String user) {
    usernameField.[1](user);
}
Drag options to blanks, or click blank then click option'
Aclick
BsendKeys
Cclear
DgetText
Attempts:
3 left
💡 Hint
Common Mistakes
Using click() instead of sendKeys() to enter text
Using getText() which only reads text, not types
3fill in blank
hard

Fix the error in the method to clear the search box before typing.

Selenium Java
public void search(String query) {
    searchBox.[1]();
    searchBox.sendKeys(query);
}
Drag options to blanks, or click blank then click option'
Aclick
Bsubmit
CgetText
Dclear
Attempts:
3 left
💡 Hint
Common Mistakes
Using click() which only focuses the element
Using getText() which reads text but does not clear
4fill in blank
hard

Fill both blanks to define a method that submits a form after entering email.

Selenium Java
public void submitEmail(String email) {
    emailField.[1](email);
    form.[2]();
}
Drag options to blanks, or click blank then click option'
AsendKeys
Bclick
Csubmit
Dclear
Attempts:
3 left
💡 Hint
Common Mistakes
Using click() on the form instead of submit()
Using clear() instead of sendKeys() to enter email
5fill in blank
hard

Fill all three blanks to create a method that clears, types, and clicks the search button.

Selenium Java
public void performSearch(String term) {
    searchInput.[1]();
    searchInput.[2](term);
    searchButton.[3]();
}
Drag options to blanks, or click blank then click option'
Aclear
BsendKeys
Cclick
Dsubmit
Attempts:
3 left
💡 Hint
Common Mistakes
Using submit() instead of click() on the button
Not clearing the input before typing