← Back to team overview

sikuli-driver team mailing list archive

[Question #674435]: Drawing on the map doesnt work in Windows 7

 

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

Scenario is to draw on the map to capture the link id's. For this we are using selenium, JAva with Sikuli Methods.

Issues:
1. In windows 10 it works perfectly. But in windows 7 it doesn't work and fails with below error
2. i gave the path to capture the screenshot and save it in path given below, but it saves it in root directory. Why?
screen.saveScreenCapture(System.getProperty("user.dir")+"\\captured_image");


PSB my code:

try
		{		
			WebElement ele = driver.findElement(By.xpath("//*[@id='Map_Div_layers']"));
			
			int x = ele.getLocation().getX();
			int y= ele.getLocation().getY();
			
			System.out.println("X: "+x);
			System.out.println("Y: "+y);
			
			Screen screen = new Screen();
			
			screen.setLocation(new Location(x,y));
			
			((JavascriptExecutor)driver).executeScript("scroll(0,200)");
			
			System.out.println("Folder to save: "+System.getProperty("user.dir")+"\\captured_image");
			
			screen.saveScreenCapture(System.getProperty("user.dir")+"\\captured_image");
			
			//String image=screen.getLastScreenImageFile();
			
			//System.out.println("Image after screen capture:"+image);
			
			Pattern p = new Pattern(screen.getLastScreenImage());
			
			System.out.println("Image in pattern:"+p.getImage());
			
			driver.findElement(By.xpath("//*[@uib-tooltip='Select Link']")).click();
			
			System.out.println("Clicked on Select Link");
			
			((JavascriptExecutor)driver).executeScript("scroll(0,-80)");
			
			System.out.println("scrolled up");
			
			//Match q =screen.find(p);
			
			//System.out.println("Find and get Image: "+q.getImage());
			
			//Location mloc=q.getCenter();
			//screen.click(mloc);
			
			screen.click(p);
			
			Location mloc = Env.getMouseLocation();
	
			//screen.doubleClick(p);
			
			screen.mouseMove(mloc.offset(-260,50));
			screen.click(mloc.offset(-260,50));
			
			screen.mouseMove(Env.getMouseLocation().offset(40,40));
			screen.click(Env.getMouseLocation().offset(40,40));
			
			screen.mouseMove(Env.getMouseLocation().offset(20,20));
			screen.click(Env.getMouseLocation().offset(20,20));
			
			screen.mouseMove(Env.getMouseLocation().offset(0,0));
			screen.click(Env.getMouseLocation().offset(0,0));
			
			screen.doubleClick(Env.getMouseLocation().offset(0,0));
		}

Below is the log:
Started InternetExplorerDriver server (32-bit)
3.9.0.0
Listening on port 37055
Only local connections are allowed
Sep 26, 2018 10:43:33 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Inside the is_login_page_open method
Checking if login button displayed
Login button displayed:  true
Entering username
Entering password
clicking submit button
clicked submit button
Checking Home Page displayed or not
Title: ERP2
X: 798
Y: 316
Sep 26, 2018 10:44:51 AM org.bridj.BridJ log
INFO: Registering type org.sikuli.util.SysJNA$WinKernel32
Sep 26, 2018 10:44:51 AM org.bridj.BridJ log
INFO: Registering type org.bridj.TimeT
Sep 26, 2018 10:44:51 AM org.bridj.BridJ log
INFO: Registering type org.bridj.TimeT$timeval_customizer
Sep 26, 2018 10:44:51 AM org.bridj.BridJ log
INFO: Registering type org.bridj.StructIO$DefaultCustomizer
Sep 26, 2018 10:44:51 AM org.bridj.BridJ log
INFO: Registering type org.bridj.TimeT$timeval
Sep 26, 2018 10:44:51 AM org.bridj.BridJ log
INFO: Registering type org.bridj.StructObject
Sep 26, 2018 10:44:51 AM org.bridj.BridJ log
INFO: Registering type org.bridj.NativeObject
Sep 26, 2018 10:44:51 AM org.bridj.BridJ log
INFO: Registering type org.bridj.AbstractIntegral
Sep 26, 2018 10:44:51 AM org.bridj.BridJ log
INFO: Registering type java.lang.Number
Image:D:\ERP2\Trunk\Selenium\1537929900313.png
Clicked on Select Link
scrolled up
FindFailed: can not find P(1537929900313.png) S: 0.7 in S(0)[0,0 1366x768]
  Line 2189, in file Region.java

        at org.sikuli.script.Region.handleFindFailedShowDialog(Region.java:2189)
        at org.sikuli.script.Region.handleFindFailed(Region.java:2134)
        at org.sikuli.script.Region.wait(Region.java:2546)
        at org.sikuli.script.Region.find(Region.java:2205)
        at serenityDemo.pages.CreateDistanceBasedLocationPage.draw_on_map(CreateDistanceBasedLocationPage.java:79)
        at serenityDemo.steps.serenity.IntranetSanitySteps.verify_user_clicked_on_the_map_to_draw(IntranetSanitySteps.java:230)
        at serenityDemo.steps.serenity.IntranetSanitySteps$$EnhancerByCGLIB$$1225fa0e.CGLIB$verify_user_clicked_on_the_map_to_draw$17(<generated>)
        at serenityDemo.steps.serenity.IntranetSanitySteps$$EnhancerByCGLIB$$1225fa0e$$FastClassByCGLIB$$cf699c5c.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
        at net.thucydides.core.steps.StepInterceptor.invokeMethod(StepInterceptor.java:426)
        at net.thucydides.core.steps.StepInterceptor.executeTestStepMethod(StepInterceptor.java:411)
        at net.thucydides.core.steps.StepInterceptor.runTestStep(StepInterceptor.java:386)
        at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:134)
        at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:63)
        at serenityDemo.steps.serenity.IntranetSanitySteps$$EnhancerByCGLIB$$1225fa0e.verify_user_clicked_on_the_map_to_draw(<generated>)
        at serenityDemo.steps.IntranetStepDefinition.thenUserClickOnTheMapToDraw(IntranetStepDefinition.java:136)
        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 cucumber.runtime.Utils$1.call(Utils.java:32)
        at cucumber.runtime.Timeout.timeout(Timeout.java:16)
        at cucumber.runtime.Utils.invoke(Utils.java:26)
        at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:37)
        at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:40)
        at cucumber.api.TestStep.executeStep(TestStep.java:102)
        at cucumber.api.TestStep.run(TestStep.java:83)
        at cucumber.api.TestCase.run(TestCase.java:58)
        at cucumber.runner.Runner.runPickle(Runner.java:80)
        at cucumber.runtime.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:140)
        at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:68)
        at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:23)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:73)
        at cucumber.api.junit.Cucumber.runChild(Cucumber.java:99)
        at cucumber.api.junit.Cucumber.runChild(Cucumber.java:41)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at cucumber.api.junit.Cucumber$1.evaluate(Cucumber.java:108)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
Map not loaded or links not extracted[Ljava.lang.StackTraceElement;@5546e754
Extracting rows
row Size of links table: 1
[main] ERROR net.serenitybdd.core.Serenity -

The two windows clients has the same monitor and the same resolution ratio.

Dose anyone else has encountered the issue? 
Any help is appreciated. 

Thx.
Sabitha

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