Class ElementActionsHelper

java.lang.Object
com.shaft.gui.element.internal.ElementActionsHelper

public class ElementActionsHelper extends Object
  • Field Details

  • Constructor Details

    • ElementActionsHelper

      public ElementActionsHelper(boolean isSilent)
  • Method Details

    • safeFindElements

      public static List<org.openqa.selenium.WebElement> safeFindElements(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By locator)
      Safely calls driver.findElements(locator), handling the infinite recursion between Selenium 4.41.0's ElementLocation and Appium java-client 10.0.0's AppiumBy.findElements(SearchContext).

      The normal driver.findElements() path is attempted first. If a StackOverflowError occurs (caused by Appium 3.x returning InvalidArgumentException for non-W3C locator strategies, triggering ElementLocationAppiumBy infinite recursion), the method falls back to sending the find command directly via AppiumDriver.execute().

      Parameters:
      driver - the WebDriver instance
      locator - the element locator
      Returns:
      the list of found elements, or an empty list if none found or an error occurs
    • safeFindElement

      public static org.openqa.selenium.WebElement safeFindElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By locator)
      Safely calls driver.findElement(locator), handling the infinite recursion between Selenium 4.41.0's ElementLocation and Appium java-client 10.0.0's AppiumBy.findElements(SearchContext).
      Parameters:
      driver - the WebDriver instance
      locator - the element locator
      Returns:
      the found element
      Throws:
      org.openqa.selenium.NoSuchElementException - if the element cannot be found
      See Also:
    • waitForElementPresence

      public List<Object> waitForElementPresence(org.openqa.selenium.WebDriver driver, String elementReferenceScreenshot)
    • waitForElementPresence

      public List<Object> waitForElementPresence(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, boolean checkForVisibility)
    • scrollToFindElement

      public List<Object> scrollToFindElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
    • waitForElementToBeClickable

      public boolean waitForElementToBeClickable(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, String actionToExecute)
    • waitForElementTextToBeNot

      public boolean waitForElementTextToBeNot(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, String textShouldNotBe)
    • executeNativeMobileCommandUsingJavascript

      public void executeNativeMobileCommandUsingJavascript(org.openqa.selenium.WebDriver driver, String command, Map<String,String> parameters)
    • submitFormUsingJavascript

      public void submitFormUsingJavascript(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
    • changeWebElementVisibilityUsingJavascript

      public void changeWebElementVisibilityUsingJavascript(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, boolean desiredIsVisibleState)
    • takeScreenshot

      public List<Object> takeScreenshot(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, String actionName, String testData, boolean passFailStatus)
    • getElementName

      public String getElementName(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
    • performClipboardActions

      public boolean performClipboardActions(org.openqa.selenium.WebDriver driver, ClipboardAction action)
    • isFoundInStacktrace

      public boolean isFoundInStacktrace(Class<?> classObject, Throwable throwable)
    • identifyUniqueElement

      public List<Object> identifyUniqueElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
    • identifyUniqueElementIgnoringVisibility

      public List<Object> identifyUniqueElementIgnoringVisibility(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
    • getMatchingElementsInformation

      public List<Object> getMatchingElementsInformation(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, boolean checkForVisibility)
    • getElementsCount

      public int getElementsCount(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
      Returns the number of elements that match a certain elementLocator
      Parameters:
      driver - the current instance of Selenium WebDriver
      elementLocator - the locator of the webElement under test (By xpath, id, selector, name ...etc.)
      Returns:
      integer value that represents the number of elements that match the desired elementLocator
    • passAction

      public void passAction(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, String testData, List<Object> screenshot, String elementName)
    • passAction

      public void passAction(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, String actionName, String testData, List<List<Object>> screenshots, String elementName)
    • failAction

      public void failAction(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, Throwable... rootCauseException)
    • failAction

      public void failAction(org.openqa.selenium.WebDriver driver, String testData, org.openqa.selenium.By elementLocator, Throwable... rootCauseException)
    • failAction

      public void failAction(org.openqa.selenium.WebDriver driver, String testData, org.openqa.selenium.By elementLocator, List<List<Object>> attachments, Throwable... rootCauseException)
    • failAction

      public void failAction(org.openqa.selenium.WebDriver driver, String actionName, String testData, org.openqa.selenium.By elementLocator, List<List<Object>> screenshots, Throwable... rootCauseException)
    • createReportMessage

      public String createReportMessage(String actionName, String testData, String elementName, Boolean passFailStatus)
    • reportActionResult

      public String reportActionResult(org.openqa.selenium.WebDriver driver, String actionName, String testData, org.openqa.selenium.By elementLocator, List<List<Object>> screenshots, String elementName, Boolean passFailStatus, Throwable... rootCauseException)