Class WebUI

java.lang.Object
com.anhtester.keywords.WebUI

public class WebUI extends Object
Keyword WebUI is a generic class that is a preprocessed library with many custom functions from Selenium and Java. Returns is a Class containing Static functions. Callback is used by taking the class name and dotting the function name (WebUI.method)
  • Constructor Details

    • WebUI

      public WebUI()
  • Method Details

    • stopSoftAssertAll

      public static void stopSoftAssertAll()
      Stop the Soft Assert of TestNG
    • smartWait

      public static void smartWait()
      Smart Waits contains waitForPageLoaded and sleep functions
    • addScreenshotToReport

      public static void addScreenshotToReport(String screenName)
      Take entire-page screenshot and add to Extent report and Allure report
      Parameters:
      screenName - Screenshot name
    • takeElementScreenshot

      public static void takeElementScreenshot(org.openqa.selenium.By by, String screenName)
      Take a screenshot of a specific web element. The captured image will be saved in '.png' format.
      Parameters:
      screenName - Screenshot name
    • takeFullPageScreenshot

      public static void takeFullPageScreenshot(String screenName)
      Take entire-page screenshot, including overflow parts. The captured image will be saved in '.png' format. This method simulates a scroll action to take a number of shots and merge them together to make a full-page screenshot.
      Parameters:
      screenName - Screenshot name
    • getPathDownloadDirectory

      public static String getPathDownloadDirectory()
      Get the Download Directory path
      Returns:
      the download directory path
    • countFilesInDownloadDirectory

      public static int countFilesInDownloadDirectory()
      Count files in Download Directory
      Returns:
      files total in download directory
    • verifyFileContainsInDownloadDirectory

      public static boolean verifyFileContainsInDownloadDirectory(String fileName)
      Verify files in the Download Directory contain the specified file (CONTAIN)
      Parameters:
      fileName - the specified file
      Returns:
      true if file is contain in download directory, else is false
    • verifyFileEqualsInDownloadDirectory

      public static boolean verifyFileEqualsInDownloadDirectory(String fileName)
      Verify files in the Download Directory contain the specified file (EQUALS)
      Parameters:
      fileName - the specified file
      Returns:
      true if file is contain in download directory, else is false
    • verifyDownloadFileContainsName

      public static boolean verifyDownloadFileContainsName(String fileName, int timeoutSeconds)
      Verify the file is downloaded (CONTAIN)
      Parameters:
      fileName - the specified file
      timeoutSeconds - System will wait at most timeout (seconds) to return result
      Returns:
      true if file is downloaded, else is false
    • verifyDownloadFileEqualsName

      public static boolean verifyDownloadFileEqualsName(String fileName, int timeoutSeconds)
      Verify the file is downloaded (EQUALS)
      Parameters:
      fileName - the specified file
      timeoutSeconds - System will wait at most timeout (seconds) to return result
      Returns:
      true if file is downloaded, else is false
    • deleteAllFileInDownloadDirectory

      public static void deleteAllFileInDownloadDirectory()
      Delete all files in Download Directory
    • deleteAllFileInDirectory

      public static void deleteAllFileInDirectory(String pathDirectory)
      Delete all files in Download Directory
      Parameters:
      pathDirectory - the Download Directory path
    • verifyFileDownloadedWithJS_Equals

      @Step("Verify File Downloaded With JS [Equals]: {0}") public static boolean verifyFileDownloadedWithJS_Equals(String fileName)
      Verify the file is downloaded with JavascriptExecutor (EQUALS)
      Parameters:
      fileName - the specified file
      Returns:
      true if file is downloaded, else is false
    • verifyFileDownloadedWithJS_Contains

      @Step("Verify File Downloaded With JS [Contains]: {0}") public static boolean verifyFileDownloadedWithJS_Contains(String fileName)
      Verify the file is downloaded with JavascriptExecutor (CONTAINS)
      Parameters:
      fileName - the specified file
      Returns:
      true if file is downloaded, else is false
    • getToUrlAuthentication

      @Step("Get to URL {0} with authentication") public static void getToUrlAuthentication(String url, String username, String password)
      Login as Authentication on URL
      Parameters:
      url -
      username -
      password -
    • getQRCodeFromImage

      @Step("Get QR code from image {0}") public static String getQRCodeFromImage(org.openqa.selenium.By by)
      Get code text of QR Code image
      Parameters:
      by - là an element of object type By
      Returns:
      text of QR Code
    • verifyHTML5RequiredField

      @Step("Verify HTML5 message of element {0} required field") public static Boolean verifyHTML5RequiredField(org.openqa.selenium.By by)
      Verify HTML5 message of element required field
      Parameters:
      by - is an element of type By
      Returns:
      true/false corresponds to required
    • verifyHTML5ValidValueField

      @Step("Verify HTML5 message of element {0} valid") public static Boolean verifyHTML5ValidValueField(org.openqa.selenium.By by)
      Verify the HTML5 message of the element has a value of Valid
      Parameters:
      by - is an element of type By
      Returns:
      true/false corresponds to Valid
    • getHTML5MessageField

      @Step("Get HTML5 message of element {0}") public static String getHTML5MessageField(org.openqa.selenium.By by)
      Get HTML5 message of element
      Parameters:
      by - is an element of type By
      Returns:
      the Text string value of the notification (String)
    • setWindowSize

      public static void setWindowSize(int widthPixel, int heightPixel)
      Set window sizes.
      Parameters:
      widthPixel - is Width with Pixel
      heightPixel - is Height with Pixel
    • setWindowPosition

      public static void setWindowPosition(int X, int Y)
      Move the window to the selected position X, Y from the top left corner 0
      Parameters:
      X - (int) - horizontal
      Y - (int) - vertical
    • maximizeWindow

      public static void maximizeWindow()
      Maximize window
    • minimizeWindow

      public static void minimizeWindow()
      Minimize window
    • screenshotElement

      public static void screenshotElement(org.openqa.selenium.By by, String elementName)
      Take a screenshot at the element location. Do not capture the entire screen.
      Parameters:
      by - is an element of type By
      elementName - to name the .png image file
    • printPage

      public static String printPage(int endPage)
      Print the current page in the browser. Note: Only works in headless mode
      Parameters:
      endPage - is the total number of pages to print. Adjective 1.
      Returns:
      is content of page form PDF file
    • getJsExecutor

      public static org.openqa.selenium.JavascriptExecutor getJsExecutor()
      Get the JavascriptExecutor object created
      Returns:
      JavascriptExecutor
    • getWebElement

      public static org.openqa.selenium.WebElement getWebElement(org.openqa.selenium.By by)
      Convert the By object to the WebElement
      Parameters:
      by - is an element of type By
      Returns:
      Returns a WebElement object
    • getWebElements

      public static List<org.openqa.selenium.WebElement> getWebElements(org.openqa.selenium.By by)
      Find multiple elements with the locator By object
      Parameters:
      by - is an element of type By
      Returns:
      Returns a List of WebElement objects
    • logConsole

      public static void logConsole(@Nullable Object object)
      Print out the message in the Console log
      Parameters:
      object - passes any object
    • sleep

      public static void sleep(double second)
      Forced wait with unit of Seconds
      Parameters:
      second - is a positive integer corresponding to the number of Seconds
    • notificationsAllow

      @Step("Allow Notifications") public static org.openqa.selenium.chrome.ChromeOptions notificationsAllow()
      Allow browser popup notifications on the website
      Returns:
      the value set Allow - belongs to the ChromeOptions object
    • notificationsBlock

      @Step("Blocked Notifications") public static org.openqa.selenium.chrome.ChromeOptions notificationsBlock()
      Block browser popup notifications on the website
      Returns:
      the value of the setup Block - belongs to the ChromeOptions object
    • uploadFileWithLocalForm

      @Step("Upload File with open Local Form") public static void uploadFileWithLocalForm(org.openqa.selenium.By by, String filePath)
      Uploading files with a click shows a form to select local files on your computer
      Parameters:
      by - is an element of type By
      filePath - the absolute path to the file on your computer
    • uploadFileWithSendKeys

      @Step("Upload File with SendKeys") public static void uploadFileWithSendKeys(org.openqa.selenium.By by, String filePath)
      Upload files by dragging the link directly into the input box
      Parameters:
      by - passes an element of object type By
      filePath - absolute path to the file
    • getCurrentUrl

      @Step("Get Current URL") public static String getCurrentUrl()
      Get current URL from current driver
      Returns:
      the current URL as String
    • getPageTitle

      @Step("Get Page Title") public static String getPageTitle()
      Get current web page's title
      Returns:
      the current URL as String
    • VerifyPageTitle

      @Step("Verify Page Title equals {0}") public static boolean VerifyPageTitle(String pageTitle)
      Verify the web page's title equals with the specified title
      Parameters:
      pageTitle - The title of the web page that needs verifying
      Returns:
      the current URL as String
    • verifyPageContainsText

      @Step("Verify Page sources Contains Text {0}") public static boolean verifyPageContainsText(String text)
      Verify if the given text presents anywhere in the page source.
      Parameters:
      text -
      Returns:
      true/false
    • verifyElementChecked

      @Step("Verify Element Checked {0}") public static boolean verifyElementChecked(org.openqa.selenium.By by)
      Verify if the given web element is checked.
      Parameters:
      by - Represent a web element as the By object
      Returns:
      true if the element is checked, otherwise false.
    • verifyElementChecked

      @Step("Verify Element Checked {0}") public static boolean verifyElementChecked(org.openqa.selenium.By by, String message)
      Verify if the given web element is checked.
      Parameters:
      by - Represent a web element as the By object
      message - the custom message if false
      Returns:
      true if the element is checked, otherwise false.
    • selectOptionDynamic

      @Step("Select Option Dynamic by Text {0}") public static boolean selectOptionDynamic(org.openqa.selenium.By objectListItem, String text)
      Select value in dropdown dynamic (not pure Select Option)
      Parameters:
      objectListItem - is the locator of the list item as a By object
      text - the value to select as Text of the item
      Returns:
      click to select a specified item with Text value
    • verifyOptionDynamicExist

      @Step("Verify Option Dynamic Exist by Text {0}") public static boolean verifyOptionDynamicExist(org.openqa.selenium.By by, String text)
      Verify All Options contains the specified text (select option)
      Parameters:
      by - Represent a web element as the By object
      text - the specified text
      Returns:
      true if all option contains the specified text
    • getOptionDynamicTotal

      @Step("Get total of Option Dynamic with list element {0}") public static int getOptionDynamicTotal(org.openqa.selenium.By objectListItem)
      Get total number of options the given web element has. (select option)
      Parameters:
      objectListItem - Represent a web element as the By object
      Returns:
      total number of options
    • selectOptionByText

      @Step("Select Option by Text {0}") public static void selectOptionByText(org.openqa.selenium.By by, String text)
      Select the options with the given label (displayed text).
      Parameters:
      by - Represent a web element as the By object
      text - the specified text of option
    • selectOptionByValue

      @Step("Select Option by Value {0}") public static void selectOptionByValue(org.openqa.selenium.By by, String value)
      Select the options with the given value.
      Parameters:
      by - Represent a web element as the By object
      value - the specified value of option
    • selectOptionByIndex

      @Step("Select Option by Index {0}") public static void selectOptionByIndex(org.openqa.selenium.By by, int index)
      Select the options with the given index.
      Parameters:
      by - Represent a web element as the By object
      index - the specified index of option
    • verifyOptionTotal

      @Step("Verify Option Total equals {0}") public static void verifyOptionTotal(org.openqa.selenium.By by, int total)
      Verify the number of options equals the specified total
      Parameters:
      by - Represent a web element as the By object
      total - the specified options total
    • verifySelectedByText

      @Step("Verify Selected Option by Text {0}") public static boolean verifySelectedByText(org.openqa.selenium.By by, String text)
      Verify if the options at the given text are selected.
      Parameters:
      by - Represent a web element as the By object
      text - the specified options text
      Returns:
      true if options given selected, else is false
    • verifySelectedByValue

      @Step("Verify Selected Option by Value {0}") public static boolean verifySelectedByValue(org.openqa.selenium.By by, String value)
      Verify if the options at the given value are selected.
      Parameters:
      by - Represent a web element as the By object
      value - the specified options value
      Returns:
      true if options given selected, else is false
    • verifySelectedByIndex

      @Step("Verify Selected Option by Index {0}") public static boolean verifySelectedByIndex(org.openqa.selenium.By by, int index)
      Verify if the options at the given index are selected.
      Parameters:
      by - Represent a web element as the By object
      index - the specified options index
      Returns:
      true if options given selected, else is false
    • switchToFrameByIndex

      @Step("Switch to Frame by Index: {0}") public static void switchToFrameByIndex(int index)
      Switch to iframe by index of iframe tag
      Parameters:
      index - index of iframe tag
    • switchToFrameByIdOrName

      @Step("Switch to Frame by ID or Name: {0}") public static void switchToFrameByIdOrName(String IdOrName)
      Switch to iframe by ID or Name of iframe tag
      Parameters:
      IdOrName - ID or Name of iframe tag
    • switchToFrameByElement

      @Step("Switch to Frame by Element {0}") public static void switchToFrameByElement(org.openqa.selenium.By by)
      Switch to iframe by Element is this iframe tag
      Parameters:
      by - iframe tag
    • switchToDefaultContent

      @Step("Switch to Default Content") public static void switchToDefaultContent()
      Switch to Default Content
    • switchToWindowOrTabByPosition

      @Step("Switch to Window or Tab by Position: {0}") public static void switchToWindowOrTabByPosition(int position)
      Switch to iframe by position of iframe tag
      Parameters:
      position - index of iframe tag
    • switchToWindowOrTabByTitle

      @Step("Switch to Window or Tab by Title: {0}") public static void switchToWindowOrTabByTitle(String title)
      Switch to popup window by title
      Parameters:
      title - title of popup window
    • switchToWindowOrTabByUrl

      @Step("Switch to Window or Tab by Url: {0}") public static void switchToWindowOrTabByUrl(String url)
      Switch to popup window by URL
      Parameters:
      url - url of popup window
    • closeCurrentWindow

      @Step("Close current Window") public static void closeCurrentWindow()
      Close current Window
    • verifyTotalOfWindowsOrTab

      @Step("Verify total of Windows or Tab") public static boolean verifyTotalOfWindowsOrTab(int number)
      Get the total number of popup windows the given web page.
      Parameters:
      number - the specified number
      Returns:
      true/false
    • openNewTab

      @Step("Open new Tab") public static void openNewTab()
      Open new Tab
    • openNewWindow

      @Step("Open new Window") public static void openNewWindow()
      Open new Window
    • switchToMainWindow

      @Step("Switch to Main Window") public static void switchToMainWindow()
      Switch to Main Window
    • switchToMainWindow

      @Step("Switch to Main Window by ID {0}") public static void switchToMainWindow(String originalWindow)
      Switch to Main Window by ID
      Parameters:
      originalWindow - ID of main window
    • switchToLastWindow

      @Step("Switch to Last Window") public static void switchToLastWindow()
      Switch to Last Window
    • acceptAlert

      @Step("Click Accept on Alert") public static void acceptAlert()
      Click Accept on Alert
    • dismissAlert

      @Step("Click Dismiss on Alert") public static void dismissAlert()
      Click Dismiss on Alert
    • getTextAlert

      @Step("Get text on Alert") public static String getTextAlert()
      Get text on Alert
    • setTextAlert

      @Step("Set text on Alert {0}") public static void setTextAlert(String text)
      Set text on Alert
    • verifyAlertPresent

      @Step("Verify Alert present with timeout {0}") public static boolean verifyAlertPresent(int timeOut)
      Verify if alert does present
      Parameters:
      timeOut - Timeout waiting for alert to present.(in seconds)
      Returns:
      true/false
    • getListElementsText

      @Step("Get List Element {0}") public static List<String> getListElementsText(org.openqa.selenium.By by)
      Get list text of specified elements
      Parameters:
      by - Represent a web element as the By object
      Returns:
      Text list of specified elements
    • verifyElementExists

      @Step("Verify element exists {0}") public static boolean verifyElementExists(org.openqa.selenium.By by)
      Verify if a web element is present (findElements.size > 0).
      Parameters:
      by - Represent a web element as the By object
      Returns:
      true/false
    • verifyEquals

      @Step("Verify Equals: {0} ---AND--- {1}") public static boolean verifyEquals(Object value1, Object value2)
      Verify if two object are equal.
      Parameters:
      value1 - The object one
      value2 - The object two
      Returns:
      true/false
    • verifyEquals

      @Step("Verify Equals: {0} ---AND--- {1}") public static boolean verifyEquals(Object value1, Object value2, String message)
      Verify if two object are equal.
      Parameters:
      value1 - The object one
      value2 - The object two
      message - The custom message if false
      Returns:
      true/false
    • verifyContains

      @Step("Verify Contains: {0} ---AND--- {1}") public static boolean verifyContains(String value1, String value2)
      Verify if the first object contains the second object.
      Parameters:
      value1 - The first object
      value2 - The second object
      Returns:
      true/false
    • verifyContains

      @Step("Verify Contains: {0} ---AND--- {1}") public static boolean verifyContains(String value1, String value2, String message)
      Verify if the first object contains the second object.
      Parameters:
      value1 - The first object
      value2 - The second object
      message - The custom message if false
      Returns:
      true/false
    • verifyTrue

      @Step("Verify TRUE with condition: {0}") public static boolean verifyTrue(Boolean condition)
      Verify the condition is true.
      Returns:
      true/false
    • verifyTrue

      @Step("Verify TRUE with condition: {0}") public static boolean verifyTrue(Boolean condition, String message)
      Verify the condition is true.
      Parameters:
      message - the custom message if false
      Returns:
      true/false
    • verifyElementText

      public static boolean verifyElementText(org.openqa.selenium.By by, String text)
      Verify text of an element. (equals)
      Parameters:
      by - Represent a web element as the By object
      text - Text of the element to verify.
      Returns:
      true if the element has the desired text, otherwise false.
    • verifyElementTextEquals

      @Step("Verify text of an element [Equals]") public static boolean verifyElementTextEquals(org.openqa.selenium.By by, String text, FailureHandling flowControl)
      Verify text of an element. (equals)
      Parameters:
      by - Represent a web element as the By object
      text - Text of the element to verify.
      flowControl - Specify failure handling schema (STOP_ON_FAILURE, CONTINUE_ON_FAILURE, OPTIONAL) to determine whether the execution should be allowed to continue or stop
      Returns:
      true if the element has the desired text, otherwise false.
    • verifyElementTextEquals

      @Step("Verify text of an element [Equals]") public static boolean verifyElementTextEquals(org.openqa.selenium.By by, String text)
      Verify text of an element. (equals)
      Parameters:
      by - Represent a web element as the By object
      text - Text of the element to verify.
      Returns:
      true if the element has the desired text, otherwise false.
    • verifyElementTextContains

      @Step("Verify text of an element [Contains]") public static boolean verifyElementTextContains(org.openqa.selenium.By by, String text, FailureHandling flowControl)
      Verify text of an element. (contains)
      Parameters:
      by - Represent a web element as the By object
      text - Text of the element to verify.
      flowControl - Specify failure handling schema (STOP_ON_FAILURE, CONTINUE_ON_FAILURE, OPTIONAL) to determine whether the execution should be allowed to continue or stop
      Returns:
      true if the element has the desired text, otherwise false.
    • verifyElementTextContains

      @Step("Verify text {1} of element [Contains] {0}") public static boolean verifyElementTextContains(org.openqa.selenium.By by, String text)
      Verify text of an element. (contains)
      Parameters:
      by - Represent a web element as the By object
      text - Text of the element to verify.
      Returns:
      true if the element has the desired text, otherwise false.
    • verifyElementClickable

      @Step("Verify element Clickable {0}") public static boolean verifyElementClickable(org.openqa.selenium.By by)
      Verify if the given element is clickable.
      Parameters:
      by - Represent a web element as the By object
      Returns:
      true/false
    • verifyElementClickable

      @Step("Verify element Clickable {0} with timeout {1} second") public static boolean verifyElementClickable(org.openqa.selenium.By by, int timeout)
      Verify if the given element is clickable. (in seconds)
      Parameters:
      by - Represent a web element as the By object
      timeout - System will wait at most timeout (seconds) to return result
      Returns:
      true/false
    • verifyElementClickable

      @Step("Verify element Clickable {0}") public static boolean verifyElementClickable(org.openqa.selenium.By by, int timeout, String message)
      Verify if the given element is clickable. (in seconds)
      Parameters:
      by - Represent a web element as the By object
      timeout - System will wait at most timeout (seconds) to return result
      message - the custom message if false
      Returns:
      true/false
    • verifyElementPresent

      @Step("Verify element present {0}") public static boolean verifyElementPresent(org.openqa.selenium.By by)
      Verify if the given web element does present on DOM.
      Parameters:
      by - Represent a web element as the By object
      Returns:
      true/false
    • verifyElementPresent

      @Step("Verify element present {0} with timeout {1} second") public static boolean verifyElementPresent(org.openqa.selenium.By by, int timeout)
      Verify if the given web element does present on DOM. (in seconds)
      Parameters:
      by - Represent a web element as the By object
      timeout - System will wait at most timeout (seconds) to return result
      Returns:
      true/false
    • verifyElementPresent

      @Step("Verify element present {0}") public static boolean verifyElementPresent(org.openqa.selenium.By by, String message)
      Verify if the given web element does present on DOM.
      Parameters:
      by - Represent a web element as the By object
      message - the custom message if false
      Returns:
      true/false
    • verifyElementPresent

      @Step("Verify element present {0} with timeout {1} second") public static boolean verifyElementPresent(org.openqa.selenium.By by, int timeout, String message)
      Verify if the given web element does present on DOM. (in seconds)
      Parameters:
      by - Represent a web element as the By object
      timeout - System will wait at most timeout (seconds) to return result
      message - the custom message if false
      Returns:
      true/false
    • verifyElementNotPresent

      @Step("Verify element NOT present {0}") public static boolean verifyElementNotPresent(org.openqa.selenium.By by)
      Verify if the given web element does NOT present on the DOM.
      Parameters:
      by - Represent a web element as the By object
      Returns:
      true/false
    • verifyElementNotPresent

      @Step("Verify element NOT present {0} with timeout {1} second") public static boolean verifyElementNotPresent(org.openqa.selenium.By by, int timeout)
      Verify if the given web element does NOT present on the DOM. (in seconds)
      Parameters:
      by - Represent a web element as the By object
      timeout - System will wait at most timeout (seconds) to return result
      Returns:
      true/false
    • verifyElementNotPresent

      @Step("Verify element NOT present {0}") public static boolean verifyElementNotPresent(org.openqa.selenium.By by, String message)
      Verify if the given web element does NOT present on the DOM.
      Parameters:
      by - Represent a web element as the By object
      message - the custom message if false
      Returns:
      true/false
    • verifyElementNotPresent

      @Step("Verify element NOT present {0} with timeout {1} second") public static boolean verifyElementNotPresent(org.openqa.selenium.By by, int timeout, String message)
      Verify if the given web element does NOT present on the DOM. (in seconds)
      Parameters:
      by - Represent a web element as the By object
      timeout - System will wait at most timeout (seconds) to return result
      message - the custom message if false
      Returns:
      true/false
    • isElementVisible

      @Step("Verify element visible {0}") public static boolean isElementVisible(org.openqa.selenium.By by, int timeout)
      Verify element is visible. (in seconds)
      Parameters:
      by - Represent a web element as the By object
      timeout - System will wait at most timeout (seconds) to return result
      Returns:
      true/false
    • verifyElementVisible

      @Step("Verify element visible {0}") public static boolean verifyElementVisible(org.openqa.selenium.By by)
      Verify if the given web element is visible.
      Parameters:
      by - Represent a web element as the By object
      Returns:
      true/false
    • verifyElementVisible

      @Step("Verify element visible {0} with timeout {1} second") public static boolean verifyElementVisible(org.openqa.selenium.By by, int timeout)
      Verify if the given web element is visible. (in seconds)
      Parameters:
      by - Represent a web element as the By object
      timeout - System will wait at most timeout (seconds) to return result
      Returns:
      true/false
    • verifyElementVisible

      @Step("Verify element visible {0}") public static boolean verifyElementVisible(org.openqa.selenium.By by, String message)
      Verify if the given web element is visible.
      Parameters:
      by - Represent a web element as the By object
      message - the custom message if false
      Returns:
      true/false
    • verifyElementVisible

      @Step("Verify element visible {0} with timeout {1} second") public static boolean verifyElementVisible(org.openqa.selenium.By by, int timeout, String message)
      Verify if the given web element is visible. (in seconds)
      Parameters:
      by - Represent a web element as the By object
      timeout - System will wait at most timeout (seconds) to return result
      message - the custom message if false
      Returns:
      true/false
    • verifyElementNotVisible

      @Step("Verify element NOT visible {0}") public static boolean verifyElementNotVisible(org.openqa.selenium.By by)
      Verify if the given web element is NOT visible.
      Parameters:
      by - Represent a web element as the By object
      Returns:
      true/false
    • verifyElementNotVisible

      @Step("Verify element NOT visible {0} with timeout {1} second") public static boolean verifyElementNotVisible(org.openqa.selenium.By by, int timeout)
      Verify if the given web element is NOT visible. (in seconds)
      Parameters:
      by - Represent a web element as the By object
      timeout - System will wait at most timeout (seconds) to return result
      Returns:
      true/false
    • verifyElementNotVisible

      @Step("Verify element NOT visible {0}") public static boolean verifyElementNotVisible(org.openqa.selenium.By by, String message)
      Verify if the given web element is NOT visible.
      Parameters:
      by - Represent a web element as the By object
      message - the custom message if false
      Returns:
      true/false
    • verifyElementNotVisible

      @Step("Verify element NOT visible {0} with timeout {1} second") public static boolean verifyElementNotVisible(org.openqa.selenium.By by, int timeout, String message)
      Verify if the given web element is NOT visible. (in seconds)
      Parameters:
      by - Represent a web element as the By object
      timeout - System will wait at most timeout (seconds) to return result
      message - the custom message if false
      Returns:
      true/false
    • scrollToElementAtTop

      @Step("Scroll to element {0}") public static void scrollToElementAtTop(org.openqa.selenium.By by)
      Scroll an element into the visible area of the browser window. (at TOP)
      Parameters:
      by - Represent a web element as the By object
    • scrollToElementAtBottom

      @Step("Scroll to element {0}") public static void scrollToElementAtBottom(org.openqa.selenium.By by)
      Scroll an element into the visible area of the browser window. (at BOTTOM)
      Parameters:
      by - Represent a web element as the By object
    • scrollToElementAtTop

      @Step("Scroll to element {0}") public static void scrollToElementAtTop(org.openqa.selenium.WebElement webElement)
      Scroll an element into the visible area of the browser window. (at TOP)
      Parameters:
      webElement - Represent a web element as the By object
    • scrollToElementAtBottom

      @Step("Scroll to element {0}") public static void scrollToElementAtBottom(org.openqa.selenium.WebElement webElement)
      Scroll an element into the visible area of the browser window. (at BOTTOM)
      Parameters:
      webElement - Represent a web element as the By object
    • scrollToPosition

      @Step("Scroll to position X={0}, Y={1}") public static void scrollToPosition(int X, int Y)
      Scroll to an offset location
      Parameters:
      X - x offset
      Y - y offset
    • hoverOnElement

      @Step("Hover on element {0}") public static boolean hoverOnElement(org.openqa.selenium.By by)
      Simulate users hovering a mouse over the given element.
      Parameters:
      by - Represent a web element as the By object
      Returns:
      true/false
    • mouseHover

      @Step("Mouse hover on element {0}") public static boolean mouseHover(org.openqa.selenium.By by)
      Simulate users hovering a mouse over the given element.
      Parameters:
      by - Represent a web element as the By object
      Returns:
      true/false
    • dragAndDrop

      @Step("Drag from element {0} to element {1}") public static boolean dragAndDrop(org.openqa.selenium.By fromElement, org.openqa.selenium.By toElement)
      Drag and drop an element onto another element.
      Parameters:
      fromElement - represent the drag-able element
      toElement - represent the drop-able element
      Returns:
      true/false
    • dragAndDropHTML5

      @Step("Drag HTML5 from element {0} to element {1}") public static boolean dragAndDropHTML5(org.openqa.selenium.By fromElement, org.openqa.selenium.By toElement)
      Drag and drop an element onto another element. (HTML5)
      Parameters:
      fromElement - represent the drag-able element
      toElement - represent the drop-able element
      Returns:
      true/false
    • dragAndDropToOffset

      @Step("Drag from element {0} to X={1}, Y={2}") public static boolean dragAndDropToOffset(org.openqa.selenium.By fromElement, int X, int Y)
      Drag an object and drop it to an offset location.
      Parameters:
      fromElement - represent the drag-able element
      X - x offset
      Y - y offset
      Returns:
      true/false
    • moveToElement

      @Step("Move to element {0}") public static boolean moveToElement(org.openqa.selenium.By toElement)
      Move to the given element.
      Parameters:
      toElement - Represent a web element as the By object
      Returns:
      true/false
    • moveToOffset

      @Step("Move to offset X={0}, Y={1}") public static boolean moveToOffset(int X, int Y)
      Move to an offset location.
      Parameters:
      X - x offset
      Y - y offset
      Returns:
      true/false
    • reloadPage

      @Step("Reload page") public static void reloadPage()
      Reload the current web page.
    • highLightElement

      @Step("Highlight on element") public static org.openqa.selenium.WebElement highLightElement(org.openqa.selenium.By by)
      Fills the border color of the specified element.
      Parameters:
      by - passes the element object in the form By
      Returns:
      Colors red borders for Elements on the website
    • openWebsite

      @Step("Open website with URL {0}") public static void openWebsite(String URL)
      Navigate to the specified URL.
      Parameters:
      URL - the specified url
    • setText

      @Step("Set text on text box") public static void setText(org.openqa.selenium.By by, String value)
      Set the value of an input field
      Parameters:
      by - an element of object type By
      value - the value to fill in the text box
    • setText

      @Step("Set text on text box and press key") public static void setText(org.openqa.selenium.By by, String value, org.openqa.selenium.Keys keys)
      Set the value of an input field and press the key on the keyboard
      Parameters:
      by - an element of object type By
      value - the value to fill in the text box
      keys - key on the keyboard to press
    • sendKeys

      @Step("Set text on text box and press key") public static void sendKeys(org.openqa.selenium.By by, org.openqa.selenium.Keys keys)
      Simulates keystroke events on the specified element, as though you typed the value key-by-key.
      Parameters:
      by - an element of object type By
      keys - key on the keyboard to press
    • sendKeys

      @Step("Set text on text box and press key") public static void sendKeys(org.openqa.selenium.Keys keys)
      Simulates keystroke events at the current position, as though you typed the value key-by-key.
      Parameters:
      keys - key on the keyboard to press
    • clearText

      @Step("Clear value in text box") public static void clearText(org.openqa.selenium.By by)
      Clear all text of the element.
      Parameters:
      by - an element of object type By
    • clearTextCtrlA

      @Step("Clear text in text box with Ctrl A") public static void clearTextCtrlA(org.openqa.selenium.By by)
      Clear all text of the element with press Ctrl A > Delete
      Parameters:
      by - an element of object type By
    • clearAndFillText

      @Step("Clear and Fill text on text box") public static void clearAndFillText(org.openqa.selenium.By by, String value)
      Clear all text of the element then set the text on that element.
      Parameters:
      by - an element of object type By
      value - the value to fill in the text box
    • clickElement

      @Step("Click on the element {0}") public static void clickElement(org.openqa.selenium.By by)
      Click on the specified element.
      Parameters:
      by - an element of object type By
    • clickElement

      @Step("Click on the element {0} with timeout {1}s") public static void clickElement(org.openqa.selenium.By by, int timeout)
      Click on element with timeout
      Parameters:
      by - an element of object type By
    • clickElementWithJs

      @Step("Click on the element by Javascript {0}") public static void clickElementWithJs(org.openqa.selenium.By by)
      Click on Elements on the web with Javascript (click implicitly without fear of being hidden)
      Parameters:
      by - an element of object type By
    • clickLinkText

      @Step("Click on the link text {0}") public static void clickLinkText(String linkText)
      Click on the link on website with text
      Parameters:
      linkText - is the visible text of a link
    • rightClickElement

      @Step("Right click on element {0}") public static void rightClickElement(org.openqa.selenium.By by)
      Right-click on the Element object on the web
      Parameters:
      by - an element of object type By
    • getTextElement

      @Step("Get text of element {0}") public static String getTextElement(org.openqa.selenium.By by)
      Get text of an element
      Parameters:
      by - an element of object type By
      Returns:
      text of a element
    • getAttributeElement

      @Step("Get attribute {1} of element {0}") public static String getAttributeElement(org.openqa.selenium.By by, String attributeName)
      Get the value from the element's attribute
      Parameters:
      by - an element of object type By
      attributeName - attribute name
      Returns:
      element's attribute value
    • getCssValueElement

      @Step("Get CSS value {1} of element {0}") public static String getCssValueElement(org.openqa.selenium.By by, String cssName)
      Get CSS value of an element
      Parameters:
      by - Represent a web element as the By object
      cssName - is CSS attribute name
      Returns:
      value of CSS attribute
    • getSizeElement

      @Step("Get Size of element {0}") public static org.openqa.selenium.Dimension getSizeElement(org.openqa.selenium.By by)
      Get size of specified element
      Parameters:
      by - Represent a web element as the By object
      Returns:
      Dimension
    • getLocationElement

      @Step("Get Location of element {0}") public static org.openqa.selenium.Point getLocationElement(org.openqa.selenium.By by)
      Get location of specified element
      Parameters:
      by - Represent a web element as the By object
      Returns:
      Point
    • getTagNameElement

      @Step("Get Tag Name of element {0}") public static String getTagNameElement(org.openqa.selenium.By by)
      Get tag name (HTML tag) of specified element
      Parameters:
      by - Represent a web element as the By object
      Returns:
      Tag name as String
    • checkEqualsValueOnTableByColumn

      @Step("Check data by EQUALS type after searching on the Table by Column.") public static void checkEqualsValueOnTableByColumn(int column, String value)
      Check the value of each column of the table when searching according to EQUAL conditions (equals)
      Parameters:
      column - column position
      value - value to compare
    • checkContainsValueOnTableByColumn

      @Step("Check data by CONTAINS type after searching on the Table by Column.") public static void checkContainsValueOnTableByColumn(int column, String value)
      Check the value of each column of the table when searching according to the CONTAINS condition (contains)
      Parameters:
      column - column position
      value - value to compare
    • checkContainsValueOnTableByColumn

      @Step("Check data by CONTAINS type after searching on the Table by Column.") public static void checkContainsValueOnTableByColumn(int column, String value, String xpathToTRtagname)
      Check the value of each column of the table when searching according to the CONTAINS condition with custom xpath
      Parameters:
      column - column position
      value - value to compare
      xpathToTRtagname - xpath value up to TR tag
    • getValueTableByColumn

      public static ArrayList getValueTableByColumn(int column)
      Get the value of a column from the table
      Parameters:
      column - column position
      Returns:
      array of values of a column
    • waitForElementVisible

      public static org.openqa.selenium.WebElement waitForElementVisible(org.openqa.selenium.By by, int timeOut)
      Wait until the given web element is visible within the timeout.
      Parameters:
      by - an element of object type By
      timeOut - maximum timeout as second
      Returns:
      a WebElement object ready to be visible
    • waitForElementVisible

      public static org.openqa.selenium.WebElement waitForElementVisible(org.openqa.selenium.By by)
      Wait until the given web element is visible.
      Parameters:
      by - an element of object type By
      Returns:
      a WebElement object ready to be visible
    • waitForElementClickable

      public static org.openqa.selenium.WebElement waitForElementClickable(org.openqa.selenium.By by, long timeOut)
      Wait for the given element to be clickable within the given time (in seconds).
      Parameters:
      by - an element of object type By
      timeOut - maximum timeout as seconds
      Returns:
      a WebElement object ready to CLICK
    • waitForElementClickable

      public static org.openqa.selenium.WebElement waitForElementClickable(org.openqa.selenium.By by)
      Wait for the given element to be clickable.
      Parameters:
      by - an element of object type By
      Returns:
      a WebElement object ready to CLICK
    • waitForElementPresent

      public static org.openqa.selenium.WebElement waitForElementPresent(org.openqa.selenium.By by, long timeOut)
      Wait for the given element to present within the given time (in seconds).
      Parameters:
      by - an element of object type By
      timeOut - maximum timeout as seconds
      Returns:
      an existing WebElement object
    • waitForElementPresent

      public static org.openqa.selenium.WebElement waitForElementPresent(org.openqa.selenium.By by)
      Wait for the given element to present
      Parameters:
      by - an element of object type By
      Returns:
      an existing WebElement object
    • waitForAlertPresent

      public static boolean waitForAlertPresent()
      Wait for an alert to present.
    • waitForAlertPresent

      public static boolean waitForAlertPresent(int timeOut)
      Wait for an alert to present.
      Parameters:
      timeOut - Timeout waiting for an alert to present.
    • waitForElementHasAttribute

      public static boolean waitForElementHasAttribute(org.openqa.selenium.By by, String attributeName)
      Wait until the given web element has an attribute with the specified name.
      Parameters:
      by - an element of object type By
      attributeName - The name of the attribute to wait for.
      Returns:
      true/false
    • verifyElementAttributeValue

      @Step("Verify element {0} with attribute {1} has value is {2}") public static boolean verifyElementAttributeValue(org.openqa.selenium.By by, String attributeName, String attributeValue)
      Verify if the web element has an attribute with the specified name and value.
      Parameters:
      by - an element of object type By
      attributeName - The name of the attribute to wait for.
      attributeValue - The value of attribute
      Returns:
      true/false
    • verifyElementHasAttribute

      @Step("Verify element {0} has attribute {1} with timeout {2} second") public static boolean verifyElementHasAttribute(org.openqa.selenium.By by, String attributeName, int timeOut)
      Verify if the web element has an attribute with the specified name.
      Parameters:
      by - Represent a web element.
      attributeName - The name of the attribute to wait for.
      timeOut - System will wait at most timeout (seconds) to return result
      Returns:
      true/false
    • waitForPageLoaded

      public static void waitForPageLoaded()
      Wait for a page to load with the default time from the config
    • waitForPageLoaded

      public static void waitForPageLoaded(int timeOut)
      Wait for a page to load within the given time (in seconds)
    • waitForJQueryLoad

      public static void waitForJQueryLoad()
      Wait for JQuery to finish loading with default time from config
    • waitForAngularLoad

      public static void waitForAngularLoad()
      Wait for Angular to finish loading with default time from config