0
0
Selenium Javatesting~5 mins

Action methods per page in Selenium Java - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are action methods in the context of a Page Object Model?
Action methods are functions inside a page class that perform user interactions like clicking buttons, entering text, or selecting options on that page.
Click to reveal answer
beginner
Why should each page class have its own action methods?
To keep tests organized and easy to maintain by grouping all actions related to a page in one place, making the code reusable and clear.
Click to reveal answer
beginner
Give an example of a simple action method in a login page class.
public void enterUsername(String username) { usernameField.sendKeys(username); } This method types the username into the username field.
Click to reveal answer
intermediate
How do action methods improve test readability?
They let test scripts read like instructions, for example: loginPage.enterUsername("user"); loginPage.clickLogin(); which is easy to understand.
Click to reveal answer
beginner
What is a best practice when naming action methods?
Use clear, simple names that describe the action, like clickSubmitButton() or selectCountry(String country), so anyone can understand what the method does.
Click to reveal answer
What is the main purpose of action methods in a page class?
ATo perform user interactions on the page
BTo store test data
CTo generate test reports
DTo configure browser settings
Where should action methods be defined in Selenium tests using Page Object Model?
AInside the test class
BIn the main method
CIn a separate utility class unrelated to pages
DInside the page class representing the web page
Which of the following is a good name for an action method that clicks a login button?
Alogin()
BbuttonClick()
CclickLoginButton()
Dclick()
Why is it better to have separate action methods for each user interaction?
ATo improve code reuse and clarity
BTo make tests slower
CTo confuse other testers
DTo avoid using locators
What should an action method NOT do?
APerform a click on a button
BDirectly assert test results
CEnter text into a field
DSelect an option from a dropdown
Explain what action methods are and why they are important in the Page Object Model.
Think about how you would tell a friend what these methods do on a webpage.
You got /3 concepts.
    Describe best practices for writing action methods in Selenium Java tests.
    Focus on naming, organization, and responsibilities.
    You got /4 concepts.