public void TestFindAllIntoRegion() { //There are 3 patterns on the test region Rectangle searchRegion = new Rectangle(1, 150, 300, 100); List <Point> points = SikuliAction.FindAll(findAllPattern, searchRegion); if (points != null) { foreach (Point point in points) { Report.Info("X:" + point.X + " Y: " + point.Y); } if (points.Count == 3) { Report.Pass("Yep! They are 3..."); } else { Report.Error("Nope! They are NOT 3, they are " + points.Count); } } else { Report.Error("Nope! There is a problem..."); } }
public void TestFindAllWithSimilarity90AndTimeout5() { //There are 6 patterns on the test image List <Point> points = SikuliAction.FindAll(findAllPattern, Similarity90, Timeout5S, Rectangle.Empty); if (points != null) { foreach (Point point in points) { Report.Info("X:" + point.X + " Y: " + point.Y); } if (points.Count == 6) { Report.Pass("Yep! They are 6..."); } else { Report.Error("Nope! They are NOT 6, they are " + points.Count); } } else { Report.Error("Nope! There is a problem..."); } }
public void TestFindAllDefault() { //There are 3 patterns on the test image List <Point> points = SikuliAction.FindAll(findAllPattern); if (points != null) { foreach (Point point in points) { Report.Info("X:" + point.X + " Y: " + point.Y); } if (points.Count == 6) { Report.Pass("Yep! They are 6..."); } else { Report.Error("Nope! They are NOT 6, they are " + points.Count); } } else { Report.Error("Nope! There is a problem..."); } }
public void DemoFindAll() { //There are 3 patterns on the test image List <Point> points = SikuliAction.FindAll(findAllPattern); if (points != null) { foreach (Point point in points) { Console.WriteLine("X:" + point.X + " Y: " + point.Y); } if (points.Count == 3) { Console.WriteLine("Yep! They are 3..."); } else { Console.WriteLine("Nope! They are NOT 3, they are " + points.Count); } } else { Console.WriteLine("Nope! There is a problem..."); } }
static void Main(string[] args) { Program demo = new Program(); demo.StartMSPaint(); demo.DemoExists(); demo.DemoFindAll(); SikuliAction.Click(demo.pattern); SikuliAction.DoubleClick(demo.extraPattern); SikuliAction.RightClick(demo.pattern); SikuliAction.Hover(demo.extraPattern); SikuliAction.DragAndDrop(demo.extraPattern, demo.pattern); demo.KillMSPaint(); demo.StartMSPaint(2); SikuliAction.Wait(demo.extraPattern, 3); demo.KillMSPaint(2); SikuliAction.WaitVanish(demo.extraPattern, 3); Console.ReadLine(); }
public void DemoExists() { if (!SikuliAction.Exists(pattern).IsEmpty) { Console.WriteLine("Yep! It's there..."); } else { Console.WriteLine("Nope! It's gone..."); } }
public void TestExistsWithSimilarity90AndTimeout5() { if (SikuliAction.Exists(pattern, Similarity90, Timeout5S).IsEmpty) { Report.Error("Nope! It's gone..."); } else { Report.Pass("Yep! It's there..."); } }
public void TestExistsDefault() { if (SikuliAction.Exists(pattern).IsEmpty) { Report.Error("Nope! It's gone..."); } else { Report.Pass("Yep! It's there..."); } }
public void TestDragAndDropDefault() { try { SikuliAction.DragAndDrop(extraPattern, pattern); Report.Pass("Yep! It's drag and dropped..."); } catch { Report.Error("Nope! It's NOT drag and dropped..."); } }
public void TestRightClickDefault() { try { SikuliAction.RightClick(pattern); Report.Pass("Yep! It's right clicked..."); } catch { Report.Error("Nope! It's NOT right clicked..."); } }
public void TestDoubleClickDefault() { try { SikuliAction.DoubleClick(extraPattern); Report.Pass("Yep! It's double clicked..."); } catch { Report.Error("Nope! It's NOT double clicked..."); } }
public void TestHoverDefault() { try { SikuliAction.Hover(pattern); Report.Pass("Yep! It's hovered..."); } catch { Report.Error("Nope! It's NOT hovered..."); } }
public void TestWaitDefaultNegative() { try { StartMSPaint(3); SikuliAction.Wait(extraPattern, 2); Report.Error("Nope! It's appeared, but it shouldn't..."); } catch { Report.Pass("Yep! It's not appeared as expected..."); } }
public void TestWaitDefaultPositive() { try { StartMSPaint(2); SikuliAction.Wait(extraPattern, 3); Report.Pass("Yep! It's appeared..."); } catch { Report.Error("Nope! It's NOT appeared..."); } }
public void TestWaitVanishDefaultPositive() { try { KillMSPaint(2); SikuliAction.WaitVanish(extraPattern, 3); Report.Pass("Yep! It's vanished..."); } catch { Report.Error("Nope! It's NOT vanished..."); } }
public void TestWaitVanishDefaultNegative() { try { KillMSPaint(3); SikuliAction.WaitVanish(extraPattern, 2); Report.Error("Nope! It's vanished, but it shouldn't..."); } catch { Report.Pass("Yep! It's not vanished as expected..."); } }
//[Test] public void ClickImage() { Thread.Sleep(5000); Console.WriteLine("Trying to click on image using sikuli"); try { SikuliAction.Click("C:\\workspace\\pscautomation\\pscwhite\\PSCTest\\PSCTest\\utilities\\lookup\\pscimage\\returncontainer.png"); } catch (Exception) { Console.WriteLine("Not able to find the element"); } Assert.Pass(); }
public static void DragAndDrop(string FromPath, string ToPath, string failMsg, int RedotimeOut = 0) { bool returnValue = false; DateTime varDateTime; DateTime varElapseTime = DateTime.Now.AddSeconds(RedotimeOut); do { varDateTime = DateTime.Now; try { SikuliAction.DragAndDrop(FromPath, ToPath); returnValue = true; break; } catch (Exception e) { } } while (varDateTime <= varElapseTime); BaseTest.Assert.IsTrue(returnValue, failMsg); }
public static void Hover(string path, string failMsg, int timeOut = 0) { bool returnValue = false; DateTime varDateTime; DateTime varElapseTime = DateTime.Now.AddSeconds(timeOut); do { varDateTime = DateTime.Now; try { SikuliAction.Hover(path); returnValue = true; break; } catch (Exception e) { } } while (varDateTime <= varElapseTime); BaseTest.Assert.IsTrue(returnValue, failMsg); }
public static void Type(string path, string input, string failMsg, int timeOut = 0) { string exceptionMsg = null; bool returnValue = false; DateTime varDateTime; DateTime varElapseTime = DateTime.Now.AddSeconds(timeOut); do { varDateTime = DateTime.Now; try { SikuliAction.Type(path, input); returnValue = true; break; } catch (Exception e) { exceptionMsg = e.Message.ToString(); } } while (varDateTime <= varElapseTime); BaseTest.Assert.IsTrue(returnValue, failMsg + "\n" + exceptionMsg); }
public static void Click(string path, string failMsg, int WaitTime = 0, int RedotimeOut = 0) { bool returnValue = false; WaitForImage(path, failMsg, WaitTime); DateTime varDateTime; DateTime varElapseTime = DateTime.Now.AddSeconds(RedotimeOut); do { varDateTime = DateTime.Now; try { SikuliAction.Click(path); returnValue = true; break; } catch (Exception e) { } } while (varDateTime <= varElapseTime); BaseTest.Assert.IsTrue(returnValue, failMsg); }
public void TestMethod1() { driver.Initialize(); driver.instance.Navigate().GoToUrl("https://www.google.co.in"); SikuliAction.Click("E:/img.png"); }