← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #246694]: Sikuli with Selenium Java

 

Question #246694 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/246694

    Status: Answered => Open

Atul Mirvankar is still having a problem:
Yes it helped and the script executed properly.

Now the only problem is regResult.text() is showing "--No Text--"

Hence, it goes to 'else' in below If condition
			
		String txtResult = regResult.text();
		if (txtResult.contains("200"))
			System.out.println("Pass: " + txtResult);
		else
		    System.out.println("Fail");
  }


If you want to see the complete code then below is the code.

public class SikuliTest {


	public static void main(String[] args) throws IOException, FindFailed, InterruptedException {
		Properties deskIcon = new Properties();
		deskIcon.load(new FileInputStream("D:\\SeleniumPractice\\WebandDesk\\OR\\PropertyFiles\\DeskIcons.properties"));
		
		App.open("calc.exe");
		Screen s = new Screen();
		
		Match m = s.getLastMatch();
		
		Pattern imgRechner = new Pattern(deskIcon.getProperty("titleCalc")).exact().targetOffset(-33, -1); // window title activated
		if (s.exists(imgRechner, 0) == null) {
		    s.click(new Pattern (deskIcon.getProperty("titleCalc")).exact()); // window title not activated
		}
		s.find(imgRechner);
		
		Region regResult = Region.create(s.getLastMatch().getTarget(), 102, 16); // get the result field
		regResult.highlight(2);
		
		s.click(deskIcon.getProperty("Calc1"));
		s.click(deskIcon.getProperty("Calc0"));
		s.click(deskIcon.getProperty("Calc0"));
		
		s.click(deskIcon.getProperty("CalcPlus"));
		
		s.click(deskIcon.getProperty("Calc1"));
		s.click(deskIcon.getProperty("Calc0"));
		s.click(deskIcon.getProperty("Calc0"));
		
		s.click(deskIcon.getProperty("CalcEqul"));
		
		Settings.OcrTextRead = true;
		
				
		String txtResult = regResult.text();
		if (txtResult.contains("200"))
			System.out.println("Pass: " + txtResult);
		else
		    System.out.println("Fail");
  }
}


This is the only issue I am facing now. Thanks in advance.

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