Bird
0
0

What is the main purpose of the @FindBy annotation in Selenium Java?

easy📝 Conceptual Q11 of 15
Selenium Java - Page Object Model
What is the main purpose of the @FindBy annotation in Selenium Java?
ATo execute JavaScript code on the web page
BTo locate web elements on a page using different strategies
CTo start the Selenium WebDriver session
DTo take screenshots during test execution
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of @FindBy

    The @FindBy annotation is used to specify how to find a web element on a page, such as by id, name, xpath, etc.
  2. Step 2: Compare with other options

    Options B, C, and D describe other Selenium features but not element locating.
  3. Final Answer:

    To locate web elements on a page using different strategies -> Option B
  4. Quick Check:

    @FindBy locates elements = A [OK]
Quick Trick: Remember: @FindBy is for locating elements only [OK]
Common Mistakes:
  • Confusing @FindBy with WebDriver commands
  • Thinking @FindBy executes scripts
  • Assuming @FindBy starts browser sessions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes