New question #252394 on Sikuli:
https://answers.launchpad.net/sikuli/+question/252394

I have below code. 

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.internal.Locatable;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
//import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.internal.Coordinates;
import org.sikuli.basics.Debug;
//import org.sikuli.basics.Settings;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Match;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;
import org.sikuli.script.Settings;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import static org.testng.Assert.*;



public class Sikuli_Play_Video {

        private static WebDriver driver;
        Screen screen = new Screen();
         static {
                    Debug.setLogFile(System.getProperty("user.dir") + 
"\\logs\\log.txt");
                      }
        
         @BeforeClass
                public void setUp() throws FindFailed, InterruptedException 
                {
                        
                                System.setProperty("webdriver.chrome.driver", 
"C:/Program Files/Google/Chrome/Application/chromedriver.exe");
                                driver = new ChromeDriver();
                                
                }
         
         public boolean ensureExists(Pattern image5) {

                 Match m = screen.exists(image5);
                 System.out.println("Result of m is " + m);

                 if (m != null) {
                  return true;
                 }
                 return false;
                }
         @Test
        
         
         public void TestplayVideo() throws FindFailed, InterruptedException
      {
         
          try
          {
        // Load 
            driver.get("sitename");
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

        //Create and initialize an instance of Screen object    
        
        String path_or = System.getProperty("user.dir") + "\\imgs";
        Settings.DebugLogs = true;
        //Add image path  
        Pattern image5 = new Pattern("imgs/play.png");
        image5.similar((float)0.77);

        WebElement element = 
driver.findElement(By.xpath("//*[@id='article-body']/article/div[1]"));
        Coordinates coordinate = ((Locatable)element).getCoordinates();
        coordinate.inViewPort();
        //Wait 10ms for image 
     screen.wait(path_or+"image5",10000);
        System.out.println("Video Still is displayed");
        

        Debug.user("Pass",image1,screen.getLastMatch());

        screen.wait(image5, 10);
        System.out.println("Play button is displayed");
        Thread.sleep(1000);
        
        Assert.assertTrue(ensureExists(image5));
        //play video
        screen.click(image5);
        
        Debug.user("we clicked %s at %s", image5, screen.getLastMatch());
         
        // Assert.assertTrue(ensureExists("image5.png"));
        //Thread.sleep(5000);
        }       
          catch(Exception e)
          {
           assertTrue(false, e.toString());
           }
      }
        @AfterClass
        public static void tearDown()
        {
                        driver.close();
                driver.quit();
        }

}

I am not able to pass this test case It does not identify image.

i dont understand what is wrong here and it does not capture any log details as 
well 

log.txt file is created but its shows blank.

Please help 

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to