public static interface WebDriver.TargetLocator
Modifier and Type | Method and Description |
---|---|
WebElement |
activeElement()
Switches to the element that currently has focus within the document currently "switched to",
or the body element if this cannot be detected.
|
Alert |
alert()
Switches to the currently active modal dialog for this particular driver instance.
|
WebDriver |
defaultContent()
Selects either the first frame on the page, or the main document when a page contains
iframes.
|
WebDriver |
frame(int index)
Select a frame by its (zero-based) index.
|
WebDriver |
frame(java.lang.String nameOrId)
Select a frame by its name or ID.
|
WebDriver |
frame(WebElement frameElement)
Select a frame using its previously located
WebElement . |
WebDriver |
newWindow(WindowType typeHint)
Creates a new browser window and switches the focus for future commands of this driver
to the new window.
|
WebDriver |
parentFrame()
Change focus to the parent context.
|
WebDriver |
window(java.lang.String nameOrHandle)
Switch the focus of future commands for this driver to the window with the given name/handle.
|
WebDriver frame(int index)
See W3C WebDriver specification for more details.
index
- (zero-based) indexNoSuchFrameException
- If the frame cannot be foundWebDriver frame(java.lang.String nameOrId)
nameOrId
- the name of the frame window, the id of the <frame> or <iframe>
element, or the (zero-based) indexNoSuchFrameException
- If the frame cannot be foundWebDriver frame(WebElement frameElement)
WebElement
.
See W3C WebDriver specification for more details.
frameElement
- The frame element to switch to.NoSuchFrameException
- If the given element is neither an IFRAME nor a FRAME element.StaleElementReferenceException
- If the WebElement has gone stale.WebDriver.findElement(By)
WebDriver parentFrame()
See W3C WebDriver specification for more details.
WebDriver window(java.lang.String nameOrHandle)
See W3C WebDriver specification for more details.
nameOrHandle
- The name of the window or the handle as returned by
WebDriver.getWindowHandle()
NoSuchWindowException
- If the window cannot be foundWebDriver newWindow(WindowType typeHint)
See W3C WebDriver specification for more details.
typeHint
- The type of new browser window to be created. The created window is not
guaranteed to be of the requested type; if the driver does not support
the requested type, a new browser window will be created of whatever type
the driver does support.WebDriver defaultContent()
See W3C WebDriver specification for more details.
WebElement activeElement()
See W3C WebDriver specification for more details.
Alert alert()
NoAlertPresentException
- If the dialog cannot be found