/// <summary> /// Compare current page with expected image. /// </summary> /// <param name="element">WindowsElement.</param> /// <param name="image">Name of expected image (without extension).</param> /// <param name="timeout">Timeout in seconds.</param> /// <param name="tolerance">Comparison tolerance as percent.</param> public void MatchElement(WindowsElement element, string image, int timeout = 10, double tolerance = 0.01) { var path = Path.Combine(Context.Settings.ImagePath, string.Format("{0}.png", image)); var result = ImageUtils.Compare(() => element.Screenshot(), path: path, timeout: timeout, tolerance: tolerance); if (result) { Log.Info(string.Format("Element matches {0}", image)); } Assert.IsTrue(result, string.Format("Element does not match {0}", image)); }