Marionette should switch back to the top-level context when switching windows

UNCONFIRMED
Unassigned

Status

Testing
Marionette
P3
normal
UNCONFIRMED
a year ago
4 months ago

People

(Reporter: juangj, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

a year ago
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.89 Safari/537.36

Steps to reproduce:

When "Switch to Window" is called with the handle of the current top-level browsing context (i.e., "switching" to the current window), the current browsing context should be reset to be equal to the top level.

== WebDriver (Python) code ==
  def testFrameSwitching(self):
    self.driver.get('http://localhost/frames.html')

    window = self.driver.current_window_handle
    self.assertEqual('outside', self.driver.find_element_by_id('x').text,
                     'Should start at top level after navigation')

    iframe = self.driver.find_element_by_tag_name('iframe')
    self.driver.switch_to.frame(iframe)
    self.assertEqual('inside', self.driver.find_element_by_id('x').text,
                     'Should switch to <iframe>')

    self.driver.switch_to.window(window)
    self.assertEqual('outside', self.driver.find_element_by_id('x').text,
                     'Should reset to top level after switching windows')

== frames.html ==
<html>
<body>
  <div id="x">outside</div>
  <iframe src="frames1.html" />
</body>
</html>

== frames1.html ==
<div id="x">inside</div>


Actual results:

In Marionette, the last assertion fails; it still considers the iframe to be the current context, instead of the top-level context associated with the window handle.


Expected results:

After switching windows, further commands should go to the top-level context.
(Reporter)

Updated

a year ago
Component: General → Marionette
Blocks: 721859
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.