Class webdriver.WebDriver.TargetLocator
Defined in: webdriver.js.
Constructor Attributes | Constructor Name and Description |
---|---|
An interface for changing the focus of the driver to another frame or window.
|
Method Attributes | Method Name and Description |
---|---|
Schedules a command retrieve the {@code document.activeElement} element on
the current document, or {@code document.body} if activeElement is not
available.
|
|
alert()
Schedules a command to change focus to the active alert dialog.
|
|
Schedules a command to switch focus of all future commands to the first frame
on the page.
|
|
frame(nameOrIndex)
Schedules a command to switch the focus of all future commands to another
frame on the page.
|
|
window(nameOrHandle)
Schedules a command to switch the focus of all future commands to another
window.
|
Class Detail
webdriver.WebDriver.TargetLocator(driver)
An interface for changing the focus of the driver to another frame or window.
- Parameters:
- {!webdriver.WebDriver} driver
- The parent driver.
Method Detail
{!webdriver.WebElement}
activeElement()
Schedules a command retrieve the {@code document.activeElement} element on
the current document, or {@code document.body} if activeElement is not
available.
- Returns:
- {!webdriver.WebElement} The active element.
{!webdriver.Alert}
alert()
Schedules a command to change focus to the active alert dialog. This command
will return a bot.ErrorCode.NO_MODAL_DIALOG_OPEN error if a modal
dialog is not currently open.
- Returns:
- {!webdriver.Alert} The open alert.
{!webdriver.promise.Promise}
defaultContent()
Schedules a command to switch focus of all future commands to the first frame
on the page.
- Returns:
- {!webdriver.promise.Promise} A promise that will be resolved when the driver has changed focus to the default content.
{!webdriver.promise.Promise}
frame(nameOrIndex)
Schedules a command to switch the focus of all future commands to another
frame on the page.
If the frame is specified by a number, the command will switch to the frame
by its (zero-based) index into the {@code window.frames} collection.
If the frame is specified by a string, the command will select the 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 its child "child".
If the specified frame can not be found, the deferred result will errback
with a {@code bot.ErrorCode.NO_SUCH_FRAME} error.
- Parameters:
- {string|number} nameOrIndex
- The frame locator.
- Returns:
- {!webdriver.promise.Promise} A promise that will be resolved when the driver has changed focus to the specified frame.
{!webdriver.promise.Promise}
window(nameOrHandle)
Schedules a command to switch the focus of all future commands to another
window. Windows may be specified by their {@code window.name} attribute or
by its handle (as returned by {@code webdriver.WebDriver#getWindowHandles}).
If the specificed window can not be found, the deferred result will errback
with a {@code bot.ErrorCode.NO_SUCH_WINDOW} error.
- Parameters:
- {string} nameOrHandle
- The name or window handle of the window to switch focus to.
- Returns:
- {!webdriver.promise.Promise} A promise that will be resolved when the driver has changed focus to the specified window.