Class OccurrenceMatchingResult

java.lang.Object
io.appium.java_client.imagecomparison.ComparisonResult
io.appium.java_client.imagecomparison.OccurrenceMatchingResult

public class OccurrenceMatchingResult extends ComparisonResult
  • Constructor Details

    • OccurrenceMatchingResult

      public OccurrenceMatchingResult(Object input)
  • Method Details

    • hasMultiple

      public boolean hasMultiple()
      Check whether the current instance contains multiple matches.
      Returns:
      True or false.
    • getRect

      public org.openqa.selenium.Rectangle getRect()
      Returns rectangle of the partial image occurrence.
      Returns:
      The region of the partial image occurrence on the full image.
    • getRect

      public org.openqa.selenium.Rectangle getRect(int matchIndex)
      Returns rectangle of the partial image occurrence for the given match index.
      Parameters:
      matchIndex - Match index.
      Returns:
      Matching rectangle.
      Throws:
      IllegalStateException - If the current instance does not represent multiple matches.
    • getScore

      public double getScore()
      Returns the score of the partial image occurrence.
      Returns:
      Matching score in range 0..1.
    • getScore

      public double getScore(int matchIndex)
      Returns the score of the partial image occurrence for the given match index.
      Parameters:
      matchIndex - Match index.
      Returns:
      Matching score in range 0..1.
      Throws:
      IllegalStateException - If the current instance does not represent multiple matches.
    • getVisualization

      public byte[] getVisualization()
      Returns the visualization of the matching result.
      Overrides:
      getVisualization in class ComparisonResult
      Returns:
      The visualization of the matching result represented as base64-encoded PNG image.
    • getVisualization

      public byte[] getVisualization(int matchIndex)
      Returns the visualization of the partial image occurrence for the given match index.
      Parameters:
      matchIndex - Match index.
      Returns:
      The visualization of the matching result represented as base64-encoded PNG image.
      Throws:
      IllegalStateException - If the current instance does not represent multiple matches.
    • storeVisualization

      public void storeVisualization(File destination) throws IOException
      Stores visualization image into the given file.
      Overrides:
      storeVisualization in class ComparisonResult
      Parameters:
      destination - File path to save the image to.
      Throws:
      IOException - On file system I/O error.
    • storeVisualization

      public void storeVisualization(int matchIndex, File destination) throws IOException
      Stores visualization image into the given file.
      Parameters:
      matchIndex - Match index.
      destination - File path to save the image to.
      Throws:
      IOException - On file system I/O error.
      IllegalStateException - If the current instance does not represent multiple matches.
    • getMultiple

      public List<OccurrenceMatchingResult> getMultiple()
      Returns the list of multiple matches (if any). This property only works if the `multiple` option is enabled.
      Returns:
      The list containing properties of each single match or an empty list.
      Throws:
      IllegalStateException - If the current instance does not represent multiple matches.
      Since:
      Appium 1.21.0