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 TypeMethod and Description
static RenderedImagegetSnapshot(org.openqa.selenium.WebElement element)
Returns a snapshot (image) of the selenium element as a Base64 string.
static voidhighlight(org.openqa.selenium.WebElement element)
Highlights the selenium element in the browser.
static voidhighlight(org.openqa.selenium.WebElement element, long t)
Highlights the selenium elements in the browser for t milliseconds.
static voidscrollIntoView(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.