Bird
0
0

Which of the following is the correct way to hold the CONTROL key and click on an element using Selenium Actions?

easy📝 Conceptual Q2 of 15
Selenium Java - Actions Class
Which of the following is the correct way to hold the CONTROL key and click on an element using Selenium Actions?
Aactions.click(element).keyDown(Keys.CONTROL).keyUp(Keys.CONTROL).perform();
Bactions.keyDown(Keys.CONTROL).click(element).keyUp(Keys.CONTROL).perform();
Cactions.keyUp(Keys.CONTROL).click(element).keyDown(Keys.CONTROL).perform();
Dactions.click(element).perform().keyDown(Keys.CONTROL).keyUp(Keys.CONTROL);
Step-by-Step Solution
Solution:
  1. Step 1: Press and hold CONTROL key before clicking

    Use keyDown(Keys.CONTROL) before click(element).
  2. Step 2: Release CONTROL key after clicking

    Use keyUp(Keys.CONTROL) after the click, then call perform().
  3. Final Answer:

    actions.keyDown(Keys.CONTROL).click(element).keyUp(Keys.CONTROL).perform(); -> Option B
  4. Quick Check:

    Hold keyDown, click, then keyUp = A [OK]
Quick Trick: Hold keyDown before action, release with keyUp after [OK]
Common Mistakes:
  • Calling perform() too early
  • Releasing key before clicking
  • Not chaining actions properly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes