← Back to team overview

sikuli-driver team mailing list archive

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

 

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

    Status: Answered => Open

sabitha is still having a problem:
Hi RaiMan

My motto is explained below


                        WebElement ele = driver.findElement(By.xpath("//*[@id='Map_Div_layers']")); // I am checking whether this element exist or not and taking the x and y coordinates
			
			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)); //I am passing the x, y coordinates to set the location
			
			((JavascriptExecutor)driver).executeScript("scroll(0,200)"); //i am scrolling down because on the map not every place has links, i scrolling to place where it see roads on the map so it can acquire links
			
			System.out.println("Folder to save: "+System.getProperty("user.dir")+"\\captured_image"); //after scrolling taking the screen capture and asking to save to that location
			
			screen.saveScreenCapture(System.getProperty("user.dir")+"\\captured_image"); 
			
			Pattern p = new Pattern(screen.getLastScreenImage()); //Sending the last captured image to pattern so i can use the methods to draw
			
			System.out.println("Image in pattern:"+p.getImage());
			
			driver.findElement(By.xpath("//*[@uib-tooltip='Select Link']")).click(); //before drawing on the map i need to click on select link 
			
			System.out.println("Clicked on Select Link"); 
			
			((JavascriptExecutor)driver).executeScript("scroll(0,-80)"); //Since the select link is very down of the screen , again i have to scroll up to draw on the map so that it can find the pattern
			
			System.out.println("scrolled up");
			
			screen.click(p); //I am clicking on that image
			
			Location mloc = Env.getMouseLocation(); //taking the mouse location
			
			screen.mouseMove(mloc.offset(-260,50)); //then draw line to that offset (using mouse move)
			screen.click(mloc.offset(-260,50)); //then click again at that location . Repeating down the same.
			
			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));
		}

My main question is when it is running perfectly in Windows 10, why it
is not running on windows 7.

Thanks

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