← Back to team overview

sikuli-driver team mailing list archive

[Question #644415]: Unable to find Pattern within a pre set region on the screen.

 

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

Attempting to set a region for each Pattern I need to find in order to improve consistency of where the mouse is clicking.

So Im setting the region (x,y,w,h) and I set the screen as Im using two monitors (I'm basing which screen off the other patterns that are already locating without a defined region)

I'm obviously setting something up incorrectly and not understanding how to do it properly.

Using Java on a MacBook Pro running Sierra 10.12.5

>>>>>>>>>>>>>>>>>CODE HERE<<<<<<<<<<<<<<<<<<<<<<<<<<

public void click9() throws FindFailed, InterruptedException {

        Region reg = new Region(1310,654,73,68);

        Screen scr1 = new Screen(0);

        try {

            scr1.setROI(reg);
            System.out.println("setROI(reg) completed.");
            scr1.click(POSItemQty9);
            System.out.println("Found 9 inside specified posItem9reg.");


            //reg.click(POSItemQty9); THIS DOESNT WORK!!!
            System.out.println("First Attempt To Find POSItemQty9 .");

        } catch (FindFailed f) {
            System.out.println("Exception In First Attempt: " + f.getMessage());

            Assert.fail("Image wasn't found. Please use correct image.");
        }

    }




<<<<<<<<<<<<<<<<<DEBUG LOGS HERE>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


First Attempt To Find Image.
[log] DOUBLE CLICK on L(1240,199)@S(0)[0,0 1680x1050] (681 msec)
Second Attempt To Find Image.
Waiting on EatInTotal button to appear.
EatInTotal button has appeared.
User has now accessed the POS system.
posOrderGeneration() has just entered....
logInCashier and userCreatedSales objects have just been created....
userLogged has been detected, now entering 'userCreatesSales.generate200InSales();' 
generate200InSales method has just entered...
setROI(reg) completed.
Exception In First Attempt: /Users/chrisrhoads/IdeaProjects/SikuliScript_POS/src/test/java/resources/RIB_POS/POSItemQty9.png: (35x44) in S(0)[0,0 1680x1050] E:Y, T:3.0

junit.framework.AssertionFailedError: Image wasn't found. Please use correct image.

	at junit.framework.Assert.fail(Assert.java:47)
	at com.qsrsoft.PageObjects.Utilities.userCreatesSales.click9(userCreatesSales.java:173)
	at com.qsrsoft.PageObjects.Utilities.userCreatesSales.buy9BigMac(userCreatesSales.java:381)
	at com.qsrsoft.PageObjects.Utilities.userCreatesSales.generate200InSales(userCreatesSales.java:72)
	at com.qsrsoft.PageObjects.RIB_POS_MainPage.posOrderGeneration(RIB_POS_MainPage.java:63)
	at pos_tests.userPlacesEatInOrder.posOrder(userPlacesEatInOrder.java:84)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
	at org.testng.TestRunner.privateRun(TestRunner.java:744)
	at org.testng.TestRunner.run(TestRunner.java:602)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
	at org.testng.SuiteRunner.run(SuiteRunner.java:289)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
	at org.testng.TestNG.runSuites(TestNG.java:1144)
	at org.testng.TestNG.run(TestNG.java:1115)
	at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
	at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:127)



Any and all help/guidance is much appreciated!

Crhoads1024


-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.