com.isomorphic.webdriver

## Class SmartClientWebDriver

- java.lang.Object
- - com.isomorphic.webdriver.SmartClientWebDriver

- Direct Known Subclasses:
    SmartClientChromeDriver, SmartClientFirefoxDriver, SmartClientIEDriver, SmartClientRemoteWebDriver

      public abstract class SmartClientWebDriver
      extends java.lang.Object

  This is an enhancement of the default `WebDriver` interface providing SmartClient specific enhancements. Additionally several extra methods are provided to correspond one to one with classic Selenium's "Selenese" test language. This, in combination with `SeleneseRunner` allows the running of Selenese test files with WebDriver.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `assertEval(java.lang.String javaScript, java.lang.Boolean expected)` Assert condition.
    `SmartClientWebDriver` | `click(org.openqa.selenium.By by)` Send a single click to the element specified by the scLocator by
    `SmartClientWebDriver` | `clickAndHold(org.openqa.selenium.By by)` Equivalent of our "mouseDown", sent to the element specified by the scLocator by
    `SmartClientWebDriver` | `contextClick(org.openqa.selenium.By by)` Send a context (right) click to the element specified by the scLocator by
    `SmartClientWebDriver` | `controlKeyDown()` To Support Selenese.
    `SmartClientWebDriver` | `controlKeyUp()` To Support Selenese.
    `SmartClientWebDriver` | `doubleClick(org.openqa.selenium.By by)` Send a double click to the element specified by the scLocator by
    `SmartClientWebDriver` | `dragAndDrop(org.openqa.selenium.By sourceBy, org.openqa.selenium.By targetBy)` Simulate a drag-and-drop from the source scLocator to the target scLocator
    `SmartClientWebDriver` | `dragAndDrop(org.openqa.selenium.By sourceBy, java.lang.String offset)` Simulate a drag-and-drop from the source scLocator to the offset coordinates
    `SmartClientWebDriver` | `dragAndDropBy(org.openqa.selenium.By sourceBy, int xOffset, int yOffset)` Simulate a drag-and-drop from the source scLocator to the offset coordinates
    `void` | `get(java.lang.String relativeUrl)` Fetch a URL relative to the baseURL.
    `void` | `get(java.lang.String relativeUrl, boolean maximize)` Fetch a URL relative to the baseURL.
    `java.lang.String` | `getTable(org.openqa.selenium.By scLocator, long row, long col)` Returns the specified table cell display value.
    `java.lang.String` | `getText(org.openqa.selenium.By scLocator)` Returns text of element associated with locator, or the value if there's no associated text.
    `java.lang.Object` | `getValue(org.openqa.selenium.By scLocator)` Returns value of element associated with locator.
    `SmartClientWebDriver` | `keyDown(org.openqa.selenium.By by, org.openqa.selenium.Keys theKey)` Send a modifer key down event to the element specified by the scLocator by
    `SmartClientWebDriver` | `keyDown(org.openqa.selenium.By by, java.lang.Long charToSend)` Send a modifer key down event to the element specified by the scLocator by
    `SmartClientWebDriver` | `keyPress(org.openqa.selenium.By by, java.lang.Long charToSend)` Similar to `SmartClientWebDriver.sendKeys(org.openqa.selenium.By, java.lang.CharSequence[])` to support selenese conversion
    `SmartClientWebDriver` | `keyPress(org.openqa.selenium.By by, java.lang.String keysToSend)` Similar to `SmartClientWebDriver.sendKeys(org.openqa.selenium.By, java.lang.CharSequence[])` to support selenese conversion
    `SmartClientWebDriver` | `keyUp(org.openqa.selenium.By by, org.openqa.selenium.Keys theKey)` Send a modifer key up event to the element specified by the scLocator by
    `SmartClientWebDriver` | `keyUp(org.openqa.selenium.By by, java.lang.Long charToSend)` Send a modifer key up event to the element specified by the scLocator by
    `SmartClientWebDriver` | `mouseMove(org.openqa.selenium.By by)` Simulate a mouseOver for the element specified by the scLocator by
    `void` | `pause(long waitInMillis)` Wait for the specified amount of time.
    `SmartClientWebDriver` | `release(org.openqa.selenium.By by)` Equivalent of our "mouseUp", sent to the element specified by the scLocator by
    `SmartClientWebDriver` | `secondClick(org.openqa.selenium.By by)` Send a second click to the element specified by the scLocator by
    `SmartClientWebDriver` | `sendKeys(org.openqa.selenium.By by, java.lang.CharSequence[] keysToSend)` Send a sequence of keys to the element specified by the scLocator by
    `void` | `setBaseUrl(java.lang.String baseUrl)` Set the Base URL against which tests will run
    `void` | `setUseFrameworkValueAsFallback(boolean useFrameworkValue)` Sets whether `SmartClientWebDriver.getValue(org.openqa.selenium.By)` should be called on locators as a fallback if `SmartClientWebDriver.getText(org.openqa.selenium.By)` is not able to find anything (other than the empty string).
    `SmartClientWebDriver` | `shiftKeyDown()` To Support Selenese.
    `SmartClientWebDriver` | `shiftKeyUp()` To Support Selenese.
    `void` | `showConsole()` Show the developer console
    `SmartClientWebDriver` | `type(org.openqa.selenium.By by)` Similar to `SmartClientWebDriver.sendKeys(org.openqa.selenium.By, java.lang.CharSequence[])` to support selenese conversion Clears existing content
    `SmartClientWebDriver` | `type(org.openqa.selenium.By by, java.lang.Long keysToSend)` Similar to `SmartClientWebDriver.sendKeys(org.openqa.selenium.By, java.lang.CharSequence[])` to support selenese conversion Clears and replaces existing content
    `SmartClientWebDriver` | `type(org.openqa.selenium.By by, java.lang.String keysToSend)` Similar to `SmartClientWebDriver.sendKeys(org.openqa.selenium.By, java.lang.CharSequence[])` to support selenese conversion Clears and replaces existing content
    `boolean` | `verifyTable(org.openqa.selenium.By scLocator, long row, long col, java.lang.String expected)` Verify that specified table cell display value matches the pattern.
    `boolean` | `verifyText(org.openqa.selenium.By scLocator, java.lang.String expected)` Assert condition.
    `boolean` | `verifyValue(org.openqa.selenium.By scLocator, java.lang.Boolean expected)` Assert condition.
    `boolean` | `verifyValue(org.openqa.selenium.By scLocator, java.lang.Integer expected)` Assert condition.
    `boolean` | `verifyValue(org.openqa.selenium.By scLocator, java.lang.Long expected)` Assert condition.
    `boolean` | `verifyValue(org.openqa.selenium.By scLocator, java.lang.String expected)` Assert condition.
    `boolean` | `waitForCondition(java.lang.String javascript)` Wait for a javascript condition to be true.
    `boolean` | `waitForElementClickable(org.openqa.selenium.By by)` Wait until a given element responds positively to the isElementClickable() call.
    `boolean` | `waitForElementNotPresent(org.openqa.selenium.By by)` Wait until a given element is no longer present.
    `boolean` | `waitForElementPresent(org.openqa.selenium.By by)` Wait until a given element is present.
    `boolean` | `waitForElementReadyForKeyPresses(org.openqa.selenium.By by)` Wait until a given element responds positively to the isElementReadyForKeyPresses() call.
    `boolean` | `waitForFrameToLoad(java.lang.String frameLocator, int secondsMax)` Wait until a frame has loaded
    `boolean` | `waitForGridDone(org.openqa.selenium.By by)` Wait until a given element responds positively to the isGridDone() call.
    `boolean` | `waitForSystemDone()` Wait until a given element responds positively to the isSystemDone() call.
    `boolean` | `waitForText(org.openqa.selenium.By by, java.lang.String string)` The same as `SmartClientWebDriver.waitForText(org.openqa.selenium.By, java.lang.String)` below.
    `boolean` | `waitForText(java.lang.String string, org.openqa.selenium.By by)` Wait until a given element has a particular text value.

- - ### Method Detail

    - #### waitForElementClickable

          public boolean waitForElementClickable(org.openqa.selenium.By by)

      Wait until a given element responds positively to the isElementClickable() call.
      Parameters:
        `by` - target element
      Returns:
        True if the element responded positively in time. False if timed out while trying

    - #### waitForElementReadyForKeyPresses

          public boolean waitForElementReadyForKeyPresses(org.openqa.selenium.By by)

      Wait until a given element responds positively to the isElementReadyForKeyPresses() call.
      Parameters:
        `by` - target element
      Returns:
        True if the element responded positively in time. False if timed out while trying

    - #### waitForFrameToLoad

          public boolean waitForFrameToLoad(java.lang.String frameLocator,
                                            int secondsMax)

      Wait until a frame has loaded
      Returns:
        True if the frame loads in time. False if timed out while trying

    - #### waitForElementPresent

          public boolean waitForElementPresent(org.openqa.selenium.By by)

      Wait until a given element is present.
      Returns:
        True if the element is present in time. False if timed out while trying

    - #### waitForElementNotPresent

          public boolean waitForElementNotPresent(org.openqa.selenium.By by)

      Wait until a given element is no longer present.
      Returns:
        True if the element is not present in time. False if timed out while trying

    - #### waitForText

          public boolean waitForText(org.openqa.selenium.By by,
                                     java.lang.String string)

      The same as `SmartClientWebDriver.waitForText(org.openqa.selenium.By, java.lang.String)` below. It would appear selenese does it either way round so we need to implement both!

    - #### waitForText

          public boolean waitForText(java.lang.String string,
                                     org.openqa.selenium.By by)

      Wait until a given element has a particular text value.
      Returns:
        True if the element responded positively in time. False if timed out while trying

    - #### waitForGridDone

          public boolean waitForGridDone(org.openqa.selenium.By by)

      Wait until a given element responds positively to the isGridDone() call.
      Parameters:
        `by` - target element
      Returns:
        True if the element responded positively in time. False if timed out while trying

    - #### waitForSystemDone

          public boolean waitForSystemDone()

      Wait until a given element responds positively to the isSystemDone() call.
      Returns:
        True if the element responded positively in time. False if timed out while trying

    - #### waitForCondition

          public boolean waitForCondition(java.lang.String javascript)

      Wait for a javascript condition to be true.

    - #### pause

          public void pause(long waitInMillis)

      Wait for the specified amount of time.
      Parameters:
        `waitInMillis` - amount of time, in milliseconds, to wait

    - #### setBaseUrl

          public void setBaseUrl(java.lang.String baseUrl)

      Set the Base URL against which tests will run

    - #### get

          public void get(java.lang.String relativeUrl)

      Fetch a URL relative to the baseURL.
      Parameters:
        `relativeUrl` - relative url

    - #### get

          public void get(java.lang.String relativeUrl,
                          boolean maximize)

      Fetch a URL relative to the baseURL.
      Parameters:
        `relativeUrl` - relative url
        `maximize` - whether to maximize window

    - #### showConsole

          public void showConsole()

      Show the developer console

    - #### sendKeys

          public SmartClientWebDriver sendKeys(org.openqa.selenium.By by,
                                               java.lang.CharSequence[] keysToSend)

      Send a sequence of keys to the element specified by the scLocator by
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element.
        `keysToSend` - the sequence(s) of keys to send
      Returns:
        Itself, in order to allow chaining calls.

    - #### type

          public SmartClientWebDriver type(org.openqa.selenium.By by)

      Similar to `SmartClientWebDriver.sendKeys(org.openqa.selenium.By, java.lang.CharSequence[])` to support selenese conversion Clears existing content
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
      Returns:
        Itself, in order to allow chaining calls.

    - #### type

          public SmartClientWebDriver type(org.openqa.selenium.By by,
                                           java.lang.String keysToSend)

      Similar to `SmartClientWebDriver.sendKeys(org.openqa.selenium.By, java.lang.CharSequence[])` to support selenese conversion Clears and replaces existing content
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
      Returns:
        Itself, in order to allow chaining calls.

    - #### type

          public SmartClientWebDriver type(org.openqa.selenium.By by,
                                           java.lang.Long keysToSend)

      Similar to `SmartClientWebDriver.sendKeys(org.openqa.selenium.By, java.lang.CharSequence[])` to support selenese conversion Clears and replaces existing content
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
      Returns:
        Itself, in order to allow chaining calls.

    - #### keyPress

          public SmartClientWebDriver keyPress(org.openqa.selenium.By by,
                                               java.lang.Long charToSend)

      Similar to `SmartClientWebDriver.sendKeys(org.openqa.selenium.By, java.lang.CharSequence[])` to support selenese conversion
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
      Returns:
        Itself, in order to allow chaining calls.

    - #### keyPress

          public SmartClientWebDriver keyPress(org.openqa.selenium.By by,
                                               java.lang.String keysToSend)

      Similar to `SmartClientWebDriver.sendKeys(org.openqa.selenium.By, java.lang.CharSequence[])` to support selenese conversion
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
      Returns:
        Itself, in order to allow chaining calls.

    - #### keyDown

          public SmartClientWebDriver keyDown(org.openqa.selenium.By by,
                                              java.lang.Long charToSend)

      Send a modifer key down event to the element specified by the scLocator by
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
        `charToSend` - Javascript key code for a modifier key
      Returns:
        Itself, in order to allow chaining calls.

    - #### keyUp

          public SmartClientWebDriver keyUp(org.openqa.selenium.By by,
                                            java.lang.Long charToSend)

      Send a modifer key up event to the element specified by the scLocator by
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
        `charToSend` - Javascript key code for a modifier key
      Returns:
        Itself, in order to allow chaining calls.

    - #### keyDown

          public SmartClientWebDriver keyDown(org.openqa.selenium.By by,
                                              org.openqa.selenium.Keys theKey)

      Send a modifer key down event to the element specified by the scLocator by
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
      Returns:
        Itself, in order to allow chaining calls.

    - #### keyUp

          public SmartClientWebDriver keyUp(org.openqa.selenium.By by,
                                            org.openqa.selenium.Keys theKey)

      Send a modifer key up event to the element specified by the scLocator by
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
      Returns:
        Itself, in order to allow chaining calls.

    - #### shiftKeyDown

          public SmartClientWebDriver shiftKeyDown()

      To Support Selenese. This causes a keydown on key 16
      Returns:
        Itself, in order to allow chaining calls.

    - #### shiftKeyUp

          public SmartClientWebDriver shiftKeyUp()

      To Support Selenese. This causes a keyup on key 16
      Returns:
        Itself, in order to allow chaining calls.

    - #### controlKeyDown

          public SmartClientWebDriver controlKeyDown()

      To Support Selenese. This causes a keydown on key 17
      Returns:
        Itself, in order to allow chaining calls.

    - #### controlKeyUp

          public SmartClientWebDriver controlKeyUp()

      To Support Selenese. This causes a keyup on key 17
      Returns:
        Itself, in order to allow chaining calls.

    - #### click

          public SmartClientWebDriver click(org.openqa.selenium.By by)

      Send a single click to the element specified by the scLocator by
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
      Returns:
        Itself, in order to allow chaining calls.

    - #### secondClick

          public SmartClientWebDriver secondClick(org.openqa.selenium.By by)

      Send a second click to the element specified by the scLocator by
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
      Returns:
        Itself, in order to allow chaining calls.

    - #### doubleClick

          public SmartClientWebDriver doubleClick(org.openqa.selenium.By by)

      Send a double click to the element specified by the scLocator by
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
      Returns:
        Itself, in order to allow chaining calls.

    - #### clickAndHold

          public SmartClientWebDriver clickAndHold(org.openqa.selenium.By by)

      Equivalent of our "mouseDown", sent to the element specified by the scLocator by
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
      Returns:
        Itself, in order to allow chaining calls.

    - #### release

          public SmartClientWebDriver release(org.openqa.selenium.By by)

      Equivalent of our "mouseUp", sent to the element specified by the scLocator by
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element
      Returns:
        Itself, in order to allow chaining calls.

    - #### contextClick

          public SmartClientWebDriver contextClick(org.openqa.selenium.By by)

      Send a context (right) click to the element specified by the scLocator by
      Parameters:
        `by` - Indicates the element concerned. If null then the previous element.
      Returns:
        Itself, in order to allow chaining calls.

    - #### mouseMove

          public SmartClientWebDriver mouseMove(org.openqa.selenium.By by)

      Simulate a mouseOver for the element specified by the scLocator by
      Parameters:
        `by` - Indicates the element to move to
      Returns:
        Itself, in order to allow chaining calls.

    - #### dragAndDrop

          public SmartClientWebDriver dragAndDrop(org.openqa.selenium.By sourceBy,
                                                  org.openqa.selenium.By targetBy)

      Simulate a drag-and-drop from the source scLocator to the target scLocator
      Parameters:
        `sourceBy` - Indicates the element to drag. If null then the previous element.
        `targetBy` - The destination
      Returns:
        Itself, in order to allow chaining calls.

    - #### dragAndDrop

          public SmartClientWebDriver dragAndDrop(org.openqa.selenium.By sourceBy,
                                                  java.lang.String offset)

      Simulate a drag-and-drop from the source scLocator to the offset coordinates
      Parameters:
        `sourceBy` - Indicates the element to drag. If null then the previous element
        `offset` - Selenese compatible string arg. Eg: "-70/+0"
      Returns:
        Itself, in order to allow chaining calls.

    - #### dragAndDropBy

          public SmartClientWebDriver dragAndDropBy(org.openqa.selenium.By sourceBy,
                                                    int xOffset,
                                                    int yOffset)

      Simulate a drag-and-drop from the source scLocator to the offset coordinates
      Parameters:
        `sourceBy` - Indicates the element to drag. If null then the previous element
      Returns:
        Itself, in order to allow chaining calls.

    - #### getValue

          public java.lang.Object getValue(org.openqa.selenium.By scLocator)

      Returns value of element associated with locator. Note that due to the underlying JavascriptExecutor rules, a number is always returned as a Long, and in Java num1.equals(num2) will fail even if num1 and num2 represent the same value if num1 is a Long and num2 is an Integer. So you should always compare the result with a Long.

      In Junit, for example: `verifyEquals(driver.getValue(locator), 1234L)`

      Returns:
        element's value

    - #### verifyValue

          public boolean verifyValue(org.openqa.selenium.By scLocator,
                                     java.lang.Boolean expected)

      Assert condition. Utility method to simplify conversion from selenese.
      Returns:
        true if the condition is matched, else false

    - #### verifyValue

          public boolean verifyValue(org.openqa.selenium.By scLocator,
                                     java.lang.Long expected)

      Assert condition. Utility method to simplify conversion from selenese.
      Returns:
        true if the condition is matched, else false

    - #### verifyValue

          public boolean verifyValue(org.openqa.selenium.By scLocator,
                                     java.lang.Integer expected)

      Assert condition. Utility method to simplify conversion from selenese.
      Returns:
        true if the condition is matched, else false

    - #### verifyValue

          public boolean verifyValue(org.openqa.selenium.By scLocator,
                                     java.lang.String expected)

      Assert condition. Utility method to simplify conversion from selenese.
      Returns:
        true if the condition is matched, else false

    - #### assertEval

          public boolean assertEval(java.lang.String javaScript,
                                    java.lang.Boolean expected)

      Assert condition. Utility method to simplify conversion from selenese.
      Returns:
        true if the condition is matched, else false

    - #### getText

          public java.lang.String getText(org.openqa.selenium.By scLocator)

      Returns text of element associated with locator, or the value if there's no associated text. (See `SmartClientWebDriver.setUseFrameworkValueAsFallback(boolean)` for details on what value is used.)
      Returns:
        element's text or value

    - #### verifyText

          public boolean verifyText(org.openqa.selenium.By scLocator,
                                    java.lang.String expected)

      Assert condition. Utility method to simplify conversion from selenese. Whitespace at either end is ignored and as in Selenium RC, globbing (* and ? characters) is supported.
      Returns:
        true if the string is matched, else false

    - #### getTable

          public java.lang.String getTable(org.openqa.selenium.By scLocator,
                                           long row,
                                           long col)

      Returns the specified table cell display value. (See `SmartClientWebDriver.setUseFrameworkValueAsFallback(boolean)` for details on what value is used.)
      Returns:
        cell's display value

    - #### verifyTable

          public boolean verifyTable(org.openqa.selenium.By scLocator,
                                     long row,
                                     long col,
                                     java.lang.String expected)

      Verify that specified table cell display value matches the pattern. Whitespace at either end is ignored and as in Selenium RC, globbing (* and ? characters) is supported.
      Returns:
        true if the table cell display value is matched, else false

    - #### setUseFrameworkValueAsFallback

          public void setUseFrameworkValueAsFallback(boolean useFrameworkValue)

      Sets whether `SmartClientWebDriver.getValue(org.openqa.selenium.By)` should be called on locators as a fallback if `SmartClientWebDriver.getText(org.openqa.selenium.By)` is not able to find anything (other than the empty string). If not set, the "value" attribute of the WebElement will be used as the fallback instead. This will typically be the "display value" of the element, rather than its "Framework value" (as returned by `SmartClientWebDriver.getValue(org.openqa.selenium.By)`). Default is true.
      Parameters:
        `useFrameworkValue` - whether to use the Framework value as the fallback