Bird
0
0

To click a button inside the inner frame, which sequence of context switches is correct?

hard📝 Application Q8 of 15
Selenium Java - Handling Windows, Frames, and Alerts
You have a web page with nested iframes: an outer frame named "outerFrame" and an inner frame named "innerFrame" inside it. To click a button inside the inner frame, which sequence of context switches is correct?
Adriver.switchTo().frame("outerFrame"); driver.switchTo().frame("innerFrame"); click button
Bdriver.switchTo().frame("innerFrame"); driver.switchTo().frame("outerFrame"); click button
Cdriver.switchTo().defaultContent(); driver.switchTo().frame("innerFrame"); click button
Ddriver.switchTo().frame("outerFrame"); driver.switchTo().defaultContent(); click button
Step-by-Step Solution
Solution:
  1. Step 1: Switch to outer frame first

    To access inner frame, first switch to its parent outer frame.
  2. Step 2: Then switch to inner frame inside outer frame

    After switching to outer frame, switch to inner frame to access its elements.
  3. Final Answer:

    driver.switchTo().frame("outerFrame"); driver.switchTo().frame("innerFrame"); click button -> Option A
  4. Quick Check:

    Nested frames require sequential switches [OK]
Quick Trick: Switch frames from outer to inner sequentially [OK]
Common Mistakes:
  • Switching inner frame before outer frame
  • Switching to default content between nested frames
  • Skipping outer frame switch

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes