I am using sikuli in windows 8

Asked by sreedeviv on 2018-07-14

   @Test
   public void runSikuli() throws FindFailed, InterruptedException{

   System.setProperty("webdriver.chrome.driver"," ");

    WebDriver driver ;

    ChromeOptions options = new ChromeOptions();
    options.addArguments("--start-maximized");
    driver = new ChromeDriver( options );

   driver.manage().window().maximize();
   driver.get("https://");
   Thread.sleep(5000);

   driver.findElement(By.id("")).clear();
   Thread.sleep(5000);
   driver.findElement(By.id((""))).sendKeys(""+Keys.ENTER);
   Thread.sleep(5000);
   driver.findElement(By.xpath( " ")).click();
   //Thread.sleep(8000);

   WebDriverWait wait3 = new WebDriverWait(driver,500);

   wait3.until(ExpectedConditions.visibilityOfElementLocated(By.id("")));

   Screen screen = new Screen();
   Pattern pattern = new Pattern("D:\\automation\\k2.png");

  if ( screen.exists(pattern) != null)
  {

   System.out.println("test passed");
  }

}
}

please help.why it fail sometimes .no error shown in console.just not printing test passed sometime,i have also added wait

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-07-14
Last reply:
2018-07-15
RaiMan (raimund-hocke) said : #1

if it does not print, then the pattern does not appear within 3 seconds.

 if ( screen.exists(pattern) != null)
  {
   System.out.println("test passed");
  } else {
   System.out.println("test failed");
 }

if it is a timing problem, the this might help:

if ( screen.exists(pattern, 10) != null)
 ....

read the docs

Can you help with this problem?

Provide an answer of your own, or ask sreedeviv for more information if necessary.

To post a message you must log in.