← 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:
Hi RaiMan,

Thanks for the code. I am able to execute the code successfully after
making some changes. However, I am getting error message.

Below is the code I am executing:

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();
		
		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(), 69, -77); // 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");
  }
}


And I am getting below error message:

[log] App.open calc.exe(5168)
[log] CLICK on L(899,293)@S(0)[0,0 1152x864]
[error] Region(866,292,69,-77) outside any screen - subsequent actions might not work as expected
[log] highlight R[866,292 69x-77]@Screen null E:Y, T:3.0 for 2.0 secs
[error] Region(863,289,75,-71) outside any screen - subsequent actions might not work as expected
Exception in thread "main" java.lang.NullPointerException
	at org.sikuli.script.ScreenHighlighter.captureScreen(ScreenHighlighter.java:156)
	at org.sikuli.script.ScreenHighlighter.highlight(ScreenHighlighter.java:133)
	at org.sikuli.script.ScreenHighlighter.highlight(ScreenHighlighter.java:143)
	at org.sikuli.script.Region.highlight(Region.java:1490)
	at org.sikuli.script.Region.highlight(Region.java:1504)
	at SikuliTest.main(SikuliTest.java:29)


Please help with this NullPointerExecption for highlight().

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