Package org.openqa.selenium.remote
Class RemoteWebDriver.RemoteTargetLocator
- java.lang.Object
-
- org.openqa.selenium.remote.RemoteWebDriver.RemoteTargetLocator
-
- All Implemented Interfaces:
WebDriver.TargetLocator
- Enclosing class:
- RemoteWebDriver
protected class RemoteWebDriver.RemoteTargetLocator extends java.lang.Object implements WebDriver.TargetLocator
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RemoteTargetLocator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 frameIndex)
Select a frame by its (zero-based) index.WebDriver
frame(java.lang.String frameName)
Select a frame by its name or ID.WebDriver
frame(WebElement frameElement)
Select a frame using its previously locatedWebElement
.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 windowHandleOrName)
Switch the focus of future commands for this driver to the window with the given name/handle.
-
-
-
Method Detail
-
frame
public WebDriver frame(int frameIndex)
Description copied from interface:WebDriver.TargetLocator
Select a frame by its (zero-based) index. Selecting a frame by index is equivalent to the JS expression window.frames[index] where "window" is the DOM window represented by the current context. Once the frame has been selected, all subsequent calls on the WebDriver interface are made to that frame.See W3C WebDriver specification for more details.
- Specified by:
frame
in interfaceWebDriver.TargetLocator
- Parameters:
frameIndex
- (zero-based) index- Returns:
- This driver focused on the given frame
-
frame
public WebDriver frame(java.lang.String frameName)
Description copied from interface:WebDriver.TargetLocator
Select a frame by its name or ID. Frames located by matching name attributes are always given precedence over those matched by ID.- Specified by:
frame
in interfaceWebDriver.TargetLocator
- Parameters:
frameName
- the name of the frame window, the id of the <frame> or <iframe> element, or the (zero-based) index- Returns:
- This driver focused on the given frame
-
frame
public WebDriver frame(WebElement frameElement)
Description copied from interface:WebDriver.TargetLocator
Select a frame using its previously locatedWebElement
.See W3C WebDriver specification for more details.
- Specified by:
frame
in interfaceWebDriver.TargetLocator
- Parameters:
frameElement
- The frame element to switch to.- Returns:
- This driver focused on the given frame.
- See Also:
WebDriver.findElement(By)
-
parentFrame
public WebDriver parentFrame()
Description copied from interface:WebDriver.TargetLocator
Change focus to the parent context. If the current context is the top level browsing context, the context remains unchanged.See W3C WebDriver specification for more details.
- Specified by:
parentFrame
in interfaceWebDriver.TargetLocator
- Returns:
- This driver focused on the parent frame
-
window
public WebDriver window(java.lang.String windowHandleOrName)
Description copied from interface:WebDriver.TargetLocator
Switch the focus of future commands for this driver to the window with the given name/handle.See W3C WebDriver specification for more details.
- Specified by:
window
in interfaceWebDriver.TargetLocator
- Parameters:
windowHandleOrName
- The name of the window or the handle as returned byWebDriver.getWindowHandle()
- Returns:
- This driver focused on the given window
-
newWindow
public WebDriver newWindow(WindowType typeHint)
Description copied from interface:WebDriver.TargetLocator
Creates a new browser window and switches the focus for future commands of this driver to the new window.See W3C WebDriver specification for more details.
- Specified by:
newWindow
in interfaceWebDriver.TargetLocator
- Parameters:
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.- Returns:
- This driver focused on the given window
-
defaultContent
public WebDriver defaultContent()
Description copied from interface:WebDriver.TargetLocator
Selects either the first frame on the page, or the main document when a page contains iframes.See W3C WebDriver specification for more details.
- Specified by:
defaultContent
in interfaceWebDriver.TargetLocator
- Returns:
- This driver focused on the top window/first frame.
-
activeElement
public WebElement activeElement()
Description copied from interface:WebDriver.TargetLocator
Switches to the element that currently has focus within the document currently "switched to", or the body element if this cannot be detected. This matches the semantics of calling "document.activeElement" in Javascript.See W3C WebDriver specification for more details.
- Specified by:
activeElement
in interfaceWebDriver.TargetLocator
- Returns:
- The WebElement with focus, or the body element if no element with focus can be detected.
-
alert
public Alert alert()
Description copied from interface:WebDriver.TargetLocator
Switches to the currently active modal dialog for this particular driver instance.- Specified by:
alert
in interfaceWebDriver.TargetLocator
- Returns:
- A handle to the dialog.
-
-