Class AppiumUtilities

java.lang.Object
com.magenic.jmaqs.appium.AppiumUtilities

public class AppiumUtilities
extends java.lang.Object
Appium Utilities class.
  • Method Summary

    Modifier and Type Method Description
    static boolean captureScreenshot​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver, AppiumTestObject testObject)
    To capture a screenshot during execution.
    static boolean captureScreenshot​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver, AppiumTestObject testObject, java.lang.String appendName)
    To capture a screenshot during execution.
    static java.lang.String captureScreenshot​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver, AppiumTestObject testObject, java.lang.String directory, java.lang.String fileNameWithoutExtension)
    To capture a screenshot during execution.
    static void killDriver​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver)
    Make sure the driver is shut down.
    static boolean savePageSource​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver, AppiumTestObject testObject)
    To capture a page source during execution.
    static boolean savePageSource​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver, AppiumTestObject testObject, java.lang.String appendName)
    To capture a page source during execution.
    static java.lang.String savePageSource​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver, AppiumTestObject testObject, java.lang.String directory, java.lang.String fileNameWithoutExtension)
    To capture Page Source during execution.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • captureScreenshot

      public static boolean captureScreenshot​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver, AppiumTestObject testObject)
      To capture a screenshot during execution. Default parameter appendName of empty string.
      Parameters:
      appiumDriver - The Appium Driver
      testObject - The Test Object to associate the screenshot.
      Returns:
      True if the image was saved successfully, otherwise false.
    • captureScreenshot

      public static boolean captureScreenshot​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver, AppiumTestObject testObject, java.lang.String appendName)
      To capture a screenshot during execution.
      Parameters:
      appiumDriver - The Appium Driver
      testObject - The Test Object to associate the screenshot.
      appendName - The Name to append
      Returns:
      True if the image was saved successfully, otherwise false.
    • captureScreenshot

      public static java.lang.String captureScreenshot​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver, AppiumTestObject testObject, java.lang.String directory, java.lang.String fileNameWithoutExtension)
      To capture a screenshot during execution.
      Parameters:
      appiumDriver - The Appium Driver
      testObject - The Test Object to associate the screenshot.
      directory - The directory file path
      fileNameWithoutExtension - File Name Without Extension
      Returns:
      Path to Screenshot.
    • savePageSource

      public static boolean savePageSource​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver, AppiumTestObject testObject)
      To capture a page source during execution. Default parameter appendName of empty string.
      Parameters:
      appiumDriver - The Appium Driver
      testObject - The Appium Test Object
      Returns:
      True if saving page source is successful, otherwise false
    • savePageSource

      public static boolean savePageSource​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver, AppiumTestObject testObject, java.lang.String appendName)
      To capture a page source during execution.
      Parameters:
      appiumDriver - The Appium Driver
      testObject - The Appium Test Object
      appendName - Appends a name to the end of a filename
      Returns:
      True if saving page source is successful, otherwise false
    • savePageSource

      public static java.lang.String savePageSource​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver, AppiumTestObject testObject, java.lang.String directory, java.lang.String fileNameWithoutExtension)
      To capture Page Source during execution.
      Parameters:
      appiumDriver - The Appium Driver
      testObject - The Appium Test Object
      directory - The directory file path
      fileNameWithoutExtension - File Name Without Extension
      Returns:
      Path to the log file
    • killDriver

      public static void killDriver​(io.appium.java_client.AppiumDriver<org.openqa.selenium.WebElement> appiumDriver)
      Make sure the driver is shut down.
      Parameters:
      appiumDriver - The Appium Driver