Share this page

# Class Utils

java.lang.Object

com.hpe.leanft.selenium.Utils

    public class Utils
    extends Object

UFT Developer for Selenium utilities.

## Constructor Summary

Constructors

Constructor and Description
`Utils()`

## Method Summary

All Methods

Modifier and Type | Method and Description
--- | ---
`static RenderedImage` | `getSnapshot(org.openqa.selenium.WebElement element)` Returns a snapshot (image) of the selenium element as a Base64 string.
`static void` | `highlight(org.openqa.selenium.WebElement element)` Highlights the selenium element in the browser.
`static void` | `highlight(org.openqa.selenium.WebElement element, long t)` Highlights the selenium elements in the browser for t milliseconds.
`static void` | `scrollIntoView(org.openqa.selenium.WebElement element)` Scrolls the page to make the web element visible.

Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Detail

Utils

    public Utils()

## Method Detail

- getSnapshot

      public static RenderedImage getSnapshot(org.openqa.selenium.WebElement element)
                                       throws IOException

  Returns a snapshot (image) of the selenium element as a Base64 string.
  Parameters:
    `element` - The element to retrieve a snapshot for.
  Returns:
    A snapshot of the element as a Base64 image.
  Throws:
    `IOException` - Thrown in case the image failed to be read.

- highlight

      public static void highlight(org.openqa.selenium.WebElement element)
                            throws InterruptedException

  Highlights the selenium element in the browser.
  Parameters:
    `element` - The web element to highlight.
  Throws:
    `InterruptedException` - Thrown in case the thread is interrupted while waiting for the highlight to finish.

- highlight

      public static void highlight(org.openqa.selenium.WebElement element,
                                   long t)
                            throws InterruptedException

  Highlights the selenium elements in the browser for t milliseconds.
  Parameters:
    `element` - The web element to highlight.
    `t` - The time (in milliseconds) that the element will be highlighted. In case of a negative number, the method throws an IllegalArgumentException. If time is less than 150, the element is not highlighted.
  Throws:
    `InterruptedException` - Thrown in case the thread is interrupted while waiting for the highlight to finish.

- scrollIntoView

      public static void scrollIntoView(org.openqa.selenium.WebElement element)

  Scrolls the page to make the web element visible.
  Parameters:
    `element` - The web element to scroll to.

Tips to improve your search results... UFT Developer for Selenium SDK (Java) Reference Version 15.0-15.0.2 UFT Developer SDK Reference All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version: