← Back to team overview

sikuli-driver team mailing list archive

[Question #254721]: Unable to match the image using "exists" method

 

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

Hi there,

I tried sikuli to handle browser Authentication pop up. I am able to enter the username and password in authentication pop up. But the problem that i am facing now is unable to match the image using exists method. 

I need to compare multiple images (say: There will be 'A', 'B', 'C' images) if A does not exists, It has to match the image of B and C. When is the condition is satisfied, it has to do appropriate action. 

Code:
import org.sikuli.basics.SikuliScript;
import org.sikuli.script.*;
import org.sikuli.*; 

public class AuthenticationHandler {

	public static void main(String[] args) {
        Screen s = new Screen();
        
        		  try{
			  Match b= s.find("D:/ScriptFiles/Workspace/SikuliTest/src/Authentication/1410953555965.png"); 
			  Match c= s.find("D:/ScriptFiles/Workspace/SikuliTest/src/Authentication/1410952744291.png");
			  Match d= s.find("D:/ScriptFiles/Workspace/SikuliTest/src/Authentication/1410953428209.png");
			  Match a= s.find("D:/ScriptFiles/Workspace/SikuliTest/src/Authentication/1410953400598.png"); 
			  Match e= s.find("D:/ScriptFiles/Workspace/SikuliTest/src/Authentication/1411044859010.png"); 
                          Match f= s.find("D:/ScriptFiles/Workspace/SikuliTest/src/Authentication/1411044859011.png");


 if(s.exists(a)!=null)
			  	{
				  System.out.println("1st");
			  	s.type(b,"clinique");
			  	s.type(c,"dfdsf");
			   	s.click(d);
			  	}
			  else if(s.exists(e)!=null)
			  	{
				  System.out.println("2nd");
				  	s.type(b,"mac");
				  	s.type(c,"asdssa");
				   	s.click(d);
			  	}	
                      else if(s.exists(f)!=null)
                           	{
				  System.out.println("3rd");
				  	s.type(b,"mac");
				  	s.type(c,"asdssa");
				   	s.click(d);
			  	}	
          
                
        }
        catch(FindFailed e){
                e.printStackTrace();
        }
}

}

Problem here is Always  the first condition is entered. Because exists method returns some value even the appropriate image is not displayed on the screen. What would be the best alternative for exists method or How can be the exists method used to solve my problem. 

Please answer my question at the earliest.

Thanks,
Vinoth


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