Bird
0
0

What is wrong with this action method?

medium📝 Debug Q7 of 15
Selenium Java - Page Object Model
What is wrong with this action method?
public void enterPassword(String pwd) {
    passwordField.sendKeys();
}
AsendKeys method is called without any argument
BpasswordField is not declared
CMethod should be static
DMethod should return String
Step-by-Step Solution
Solution:
  1. Step 1: Review sendKeys usage

    sendKeys requires a String argument to input text into the field.
  2. Step 2: Identify the error

    Calling sendKeys() without arguments causes a compile-time error.
  3. Final Answer:

    sendKeys method is called without any argument -> Option A
  4. Quick Check:

    sendKeys needs a String argument [OK]
Quick Trick: sendKeys must have text argument inside parentheses [OK]
Common Mistakes:
MISTAKES
  • Calling sendKeys with no parameters
  • Assuming passwordField is undeclared without evidence
  • Thinking method must be static or return String

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes