Class FluentTargetLocatorImpl<T>

java.lang.Object
io.fluentlenium.core.switchto.FluentTargetLocatorImpl<T>
Type Parameters:
T - self type
All Implemented Interfaces:
FluentTargetLocator<T>

public class FluentTargetLocatorImpl<T> extends Object implements FluentTargetLocator<T>
Fluent wrapper for WebDriver.TargetLocator.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FluentTargetLocatorImpl (T self, ComponentInstantiator componentInstantiator, org.openqa.selenium.WebDriver.TargetLocator targetLocator)
    Creates a new fluent target locator
  • Method Summary

    Modifier and Type
    Method
    Description
    Switches to the element that currently has focus within the document currently "switched to", or the body element if this cannot be detected.
    Switches to the currently active modal dialog for this particular driver instance.
    T
    Selects either the first frame on the page, or the main document when a page contains iframes.
    T
    frame (int index)
    Select a frame by its (zero-based) index.
    T
    frame (String nameOrId)
    Select a frame by its name or ID.
    T
    frame (FluentWebElement frameElement)
    Select a frame using its previously located WebElement.
    T
    frame (org.openqa.selenium.WebElement frameElement)
    Select a frame using its previously located WebElement.
    T
    Change focus to the parent context.
    T
    window (String nameOrHandle)
    Switch the focus of future commands for this driver to the window with the given name/handle.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FluentTargetLocatorImpl

      public FluentTargetLocatorImpl (T self, ComponentInstantiator componentInstantiator, org.openqa.selenium.WebDriver.TargetLocator targetLocator)
      Creates a new fluent target locator
      Parameters:
      self - object returned by this target locator
      componentInstantiator - component instantiator
      targetLocator - underlying target locator
  • Method Details

    • frame

      public T frame (int index)
      Description copied from interface: FluentTargetLocator
      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.
      Specified by:
      frame in interface FluentTargetLocator<T>
      Parameters:
      index - (zero-based) index
      Returns:
      $this reference for chain calls.
    • frame

      public T frame (String nameOrId)
      Description copied from interface: FluentTargetLocator
      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 interface FluentTargetLocator<T>
      Parameters:
      nameOrId - 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 T frame (org.openqa.selenium.WebElement frameElement)
      Description copied from interface: FluentTargetLocator
      Select a frame using its previously located WebElement.
      Specified by:
      frame in interface FluentTargetLocator<T>
      Parameters:
      frameElement - The frame element to switch to.
      Returns:
      This driver focused on the given frame.
    • frame

      public T frame (FluentWebElement frameElement)
      Description copied from interface: FluentTargetLocator
      Select a frame using its previously located WebElement.
      Specified by:
      frame in interface FluentTargetLocator<T>
      Parameters:
      frameElement - The frame element to switch to.
      Returns:
      This driver focused on the given frame.
    • parentFrame

      public T parentFrame()
      Description copied from interface: FluentTargetLocator
      Change focus to the parent context. If the current context is the top level browsing context, the context remains unchanged.
      Specified by:
      parentFrame in interface FluentTargetLocator<T>
      Returns:
      This driver focused on the parent frame
    • window

      public T window (String nameOrHandle)
      Description copied from interface: FluentTargetLocator
      Switch the focus of future commands for this driver to the window with the given name/handle.
      Specified by:
      window in interface FluentTargetLocator<T>
      Parameters:
      nameOrHandle - The name of the window or the handle as returned by WebDriver.getWindowHandle()
      Returns:
      This driver focused on the given window
    • defaultContent

      public T defaultContent()
      Description copied from interface: FluentTargetLocator
      Selects either the first frame on the page, or the main document when a page contains iframes.
      Specified by:
      defaultContent in interface FluentTargetLocator<T>
      Returns:
      This driver focused on the top window/first frame.
    • activeElement

      public FluentWebElement activeElement()
      Description copied from interface: FluentTargetLocator
      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.
      Specified by:
      activeElement in interface FluentTargetLocator<T>
      Returns:
      The WebElement with focus, or the body element if no element with focus can be detected.
    • alert

      public AlertImpl alert()
      Description copied from interface: FluentTargetLocator
      Switches to the currently active modal dialog for this particular driver instance.
      Specified by:
      alert in interface FluentTargetLocator<T>
      Returns:
      A handle to the dialog.