Bird
0
0

What will happen if you omit perform() in this code?

medium📝 Predict Output Q5 of 15
Selenium Java - Actions Class
What will happen if you omit perform() in this code?
Actions action = new Actions(driver);
action.doubleClick(element).build();
AThe double click will not be executed
BThe double click will execute once
CA compile-time error occurs
DThe test will crash at runtime
Step-by-Step Solution
Solution:
  1. Step 1: Understand build() vs perform()

    build() prepares the action but does not execute it.
  2. Step 2: Recognize perform() triggers execution

    Without perform(), the action is never sent to the browser.
  3. Final Answer:

    The double click will not be executed -> Option A
  4. Quick Check:

    Omitting perform() means no action execution = A [OK]
Quick Trick: Always call perform() to execute Actions [OK]
Common Mistakes:
MISTAKES
  • Assuming build() runs the action
  • Expecting compile errors without perform()
  • Thinking test crashes without perform()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes