Interface CfLocator

All Known Implementing Classes:
CfAbstractLocator, FoundElement, SeleniumLocator

public interface CfLocator
  • Method Details

    • $

      CfLocator $(String selector, Object... selectorParams)
      get sub-locator related to current one
      Returns:
      Cfloctor
    • hasClass

      boolean hasClass(String cssClass)
      Parameters:
      cssClass - name
      Returns:
      if element have given css class
    • getText

      String getText()
      Returns:
      text of element
    • innerHtml

      String innerHtml()
      Returns:
      inner html of element
    • outerHtml

      String outerHtml()
      Returns:
      outer html of element
    • getValue

      String getValue()
      Returns:
      value of element
    • getAttribute

      String getAttribute(String name)
      Returns:
      javascript attribute of element
    • getCssValue

      String getCssValue(String name)
      Parameters:
      name - eg. color, opacity, etc.
      Returns:
      css value of given name
    • exists

      boolean exists()
      Returns:
      true if element exists in DOM
    • getTagName

      String getTagName()
      Returns:
      html tag name
    • isDisplayed

      boolean isDisplayed()
      Returns:
      true if element is visible, not throw if element not found - just return false
    • click

      void click()
      Click on element
    • tap

      void tap()
      Tap gesture on element
    • focus

      void focus()
      Focus on element using JS
    • hover

      void hover()
      Hover mouse on element
    • dragTo

      void dragTo(CfLocator target)
      Drag current element onto other element
    • setValue

      void setValue(String value)
      Generic set value of element. Should work on input, textarea, select, etc.
      Parameters:
      value - to set
    • setChecked

      void setChecked(boolean state)
      Check/uncheck checkbox
      Parameters:
      state - true- check, false - uncheck
    • clear

      void clear()
      Clear given input/textarea/select/checkbox
    • type

      void type(String keys)
      Type keys into element
      Parameters:
      keys - keyboard input, can use special keys in format: {Ctrl}, {Ctrl+Shift+L}, {Shift+some text} etc.
    • count

      int count()
      Returns:
      number of elements found by locator
    • executeJs

      Object executeJs(String script, Object... args)
      Executes JavaScript code, where "this" is current element
      Parameters:
      script - JS Code
      args - arguments for JS code
      Returns:
      result of JS code
    • map

      <T> List<T> map(Function<CfLocator,T> func)
      Does mapping against each element found by locator
      Type Parameters:
      T - mapping result type
      Parameters:
      func - mapping function, eg. locator -> locator.getText()
      Returns:
      list of mapped values
    • nth

      CfLocator nth(int nth)
      nth element found by locator
      Parameters:
      nth - index starting of 1
      Returns:
      CfLocator