org.openqa.selenium
Interface WebDriver.TargetLocator

Enclosing interface:
WebDriver

public static interface WebDriver.TargetLocator

Used to locate a given frame or window.


Method Summary
 WebElement activeElement()
          Switches to the element that currently has focus, or the body element if this cannot be detected.
 WebDriver defaultContent()
          Selects either the first frame on the page, or the main document when a page contains iframes.
 WebDriver frame(int frameIndex)
          Select a frame by its (zero-based) index.
 WebDriver frame(java.lang.String frameName)
          Select a frame by its name or ID.
 WebDriver window(java.lang.String windowName)
          Switch the focus of future commands for this driver to the window with the given name
 

Method Detail

frame

WebDriver frame(int frameIndex)
Select a frame by its (zero-based) index. That is, if a page has three frames, the first frame would be at index "0", the second at index "1" and the third at index "2". Once the frame has been selected, all subsequent calls on the WebDriver interface are made to that frame.

Parameters:
frameIndex -
Returns:
A driver focused on the given frame
Throws:
NoSuchFrameException - If the frame cannot be found

frame

WebDriver frame(java.lang.String frameName)
Select a frame by its name or ID. To select sub-frames, simply separate the frame names/IDs by dots. As an example "main.child" will select the frame with the name "main" and then it's child "child". If a frame name is a number, then it will be treated as selecting a frame as if using.

Parameters:
frameName -
Returns:
A driver focused on the given frame
Throws:
NoSuchFrameException - If the frame cannot be found

window

WebDriver window(java.lang.String windowName)
Switch the focus of future commands for this driver to the window with the given name

Parameters:
windowName -
Returns:
A driver focused on the given window
Throws:
NoSuchWindowException - If the window cannot be found

defaultContent

WebDriver defaultContent()
Selects either the first frame on the page, or the main document when a page contains iframes.


activeElement

WebElement activeElement()
Switches to the element that currently has focus, or the body element if this cannot be detected.

Returns:
The WebElement with focus, or the body element if no element with focus can be detected.


Copyright © 2010. All Rights Reserved.