This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
https://dvcs.w3.org/hg/webdriver/raw-file/default/webdriver-spec.html#switching-frames switchToFrame currently accepts a WebElement (as a reference to an iframe/frame element), DOMString (as the frame name or id), or number (the frame index) as an argument. The spec should be updated to drop support for DOMString, as these selection methods are redundant with WebElement. Furthermore, even though the spec outlines how DOMString should be handled, it is ambiguous from an API perspective. Given a DOMString argument, should WebDriver select the frame with that name, or the frame with that ID? By supporting only an index number or WebElement reference, switchToFrame would present an unambiguous API with clearly defined behavior. To select a frame by name: webElement = findElement(Locator("name", "X")) switchToFrame(webElement) Likewise, to switch to a frame by ID: webElement = findElement(Locator("id", "X")) switchToFrame(webElement)
I suggest to deprecate swithing by index too. Yes, it is unambiguous, but the order of frames can vary among browsers. According to the specification switching by number is equivalent of the JS expression "window.frames[n]". Let's consider a sample: http://jsfiddle.net/barancev/e6ahn/2/show/light/ This page has a static iframe (let's call it "8uua7") and a dynamic iframe (let's call it "2P8u6") created by JS and inserted before the static one. So the tree (DOM) order of frames is 1) "2P8u6", 2) "8uua7". What browsers think about the order of the frames in the array window.frames on this page? IE: 1) "2P8u6", 2) "8uua7", all right. Firefox: 1) "8uua7", 2) "2P8u6", the order is opposite to the tree order. Chrome: 1) "8uua7", 2) "2P8u6", the same as Firefox. And as soon as the browser behaviour is incosistent here we'd better not propagate this incosistency to the WebDriver API.
reading http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#accessing-other-browsing-contexts it would appear that Chrome and Firefox do not conform to this which means using it by index Raised https://bugzilla.mozilla.org/show_bug.cgi?id=972902 related to this
we are going to remove the locators by name and ID. We will keep window.frames[n] and WebElement with WebElement being the favoured way.
*** Bug 24837 has been marked as a duplicate of this bug. ***
Created attachment 1441 [details] frame_switching_patch.txt
*** Bug 24989 has been marked as a duplicate of this bug. ***
landed in https://dvcs.w3.org/hg/webdriver/rev/561e13778acb