# HG changeset patch # User Luke Inman-Semerau # Date 1393521085 28800 # Thu Feb 27 09:11:25 2014 -0800 # Node ID f1ca7bc26480432f3e683c200f7e564330f20f35 # Parent ac1cadc3266127f5e8ed9ca200d439fcee824d69 imported patch frameSwitching diff -r ac1cadc32661 -r f1ca7bc26480 07_switching.html --- a/07_switching.html Thu Feb 27 00:26:48 2014 +0000 +++ b/07_switching.html Thu Feb 27 09:11:25 2014 -0800 @@ -40,32 +40,49 @@
void switchToFrame()
+ + + + + + + + + + + +
HTTP MethodPath TemplateNotes
POST/session/{sessionId}/frame
-
WebElement or DOMString or number? id
+
WebElement or number? id
The identifier used for a frame.
-

The "switchToFrame" command is used to select which frame within a window MUST be used as the context for handling future commands. All frame switching is taken from the current context from which commands are currently being handled. The "id" parameter can be one of a string, number of an element. WebDriver implementations MUST determine which frame to select using the following algorithm: +

The "switchToFrame" command is used to select which frame within a window MUST be used as the context for handling future commands. All frame switching is taken from the current context from which commands are currently being handled. The "id" parameter can be a number or a WebElement. WebDriver implementations MUST determine which frame to select using the following algorithm:

  1. If the "id" is a number the current context is set to the equivalent of the JS expression "window.frames[n]" where "n" is the number and "window" is the DOM window represented by the current context.
  2. If the "id" is null, the current context is set to the default context.
  3. -
  4. If the "id" is a string: -
      -
    1. If the JS expression "window.frames[id]" evaluated in the current context returns a window, where "id" is the value of the the "id" parameter, the current context is set to that.
    2. -
    3. Otherwise for each value of "window.frames" (referred to as win): -
        -
      1. If win has a "name" property or attribute equal to the "id" parameter, this becomes the current context.
      2. -
      3. If win has an "id" property or attribute equal to the "id" parameter, this becomes the current context.
      4. -
      -
    4. -
    -
  5. -
  6. If the "id" represents a WebElement, and the corresponding DOM element represents a FRAME or an IFRAME, and the WebElement is part of the current context, the "window" property of that DOM element becomes the current context.
  7. +
  8. If the "id" represents a WebElement, and the corresponding DOM element represents a FRAME or an IFRAME, and the WebElement is part of the current context, the "window" property of that DOM element becomes the current context.

In all cases if no match is made a "no such frame" status code MUST be returned.

If the indicated frame exists, frame switching MUST succeed even if doing so would violate the normal security constraints in place within the Javascript sandbox.

+
void switchToParentFrame()
+
+ + + + + + + + + + + +
HTTP MethodPath TemplateNotes
POST/session/{sessionId}/frame/parent
+

The "switchToParentFrame" command MUST set the context of future commands to the window.parent. If the current context is the [[!HTML5]]'s top level browsing context, the context remains unchanged.

+
diff -r ac1cadc32661 -r f1ca7bc26480 webdriver-spec.html --- a/webdriver-spec.html Thu Feb 27 00:26:48 2014 +0000 +++ b/webdriver-spec.html Thu Feb 27 09:11:25 2014 -0800 @@ -850,32 +850,49 @@
void switchToFrame()
+ + + + + + + + + + + +
HTTP MethodPath TemplateNotes
POST/session/{sessionId}/frame
-
WebElement or DOMString or number? id
+
WebElement or number? id
The identifier used for a frame.
-

The "switchToFrame" command is used to select which frame within a window MUST be used as the context for handling future commands. All frame switching is taken from the current context from which commands are currently being handled. The "id" parameter can be one of a string, number of an element. WebDriver implementations MUST determine which frame to select using the following algorithm: +

The "switchToFrame" command is used to select which frame within a window MUST be used as the context for handling future commands. All frame switching is taken from the current context from which commands are currently being handled. The "id" parameter can be a number or a WebElement. WebDriver implementations MUST determine which frame to select using the following algorithm:

  1. If the "id" is a number the current context is set to the equivalent of the JS expression "window.frames[n]" where "n" is the number and "window" is the DOM window represented by the current context.
  2. If the "id" is null, the current context is set to the default context.
  3. -
  4. If the "id" is a string: -
      -
    1. If the JS expression "window.frames[id]" evaluated in the current context returns a window, where "id" is the value of the the "id" parameter, the current context is set to that.
    2. -
    3. Otherwise for each value of "window.frames" (referred to as win): -
        -
      1. If win has a "name" property or attribute equal to the "id" parameter, this becomes the current context.
      2. -
      3. If win has an "id" property or attribute equal to the "id" parameter, this becomes the current context.
      4. -
      -
    4. -
    -
  5. -
  6. If the "id" represents a WebElement, and the corresponding DOM element represents a FRAME or an IFRAME, and the WebElement is part of the current context, the "window" property of that DOM element becomes the current context.
  7. +
  8. If the "id" represents a WebElement, and the corresponding DOM element represents a FRAME or an IFRAME, and the WebElement is part of the current context, the "window" property of that DOM element becomes the current context.

In all cases if no match is made a "no such frame" status code MUST be returned.

If the indicated frame exists, frame switching MUST succeed even if doing so would violate the normal security constraints in place within the Javascript sandbox.

+
void switchToParentFrame()
+
+ + + + + + + + + + + +
HTTP MethodPath TemplateNotes
POST/session/{sessionId}/frame/parent
+

The "switchToParentFrame" command MUST set the context of future commands to the window.parent. If the current context is the [[!HTML5]]'s top level browsing context, the context remains unchanged.

+