← 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

sabitha gave more information on the question:
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
Sabitha

On Thu, Sep 27, 2018 at 8:03 PM RaiMan <question674435@xxxxxxxxxxxxxxxxxxxxx>
wrote:

> Your question #674435 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/674435
>
>     Status: Open => Answered
>
> RaiMan proposed the following answer:
> --- screen.saveScreenCapture()
> ... captures the screen content and saves it to the given path as a
> timestamped PNG file
> ... the BufferedImage (ScreenImage) from the capture is stored in-memory
> with the screen object
> ... it returns the absolute path to the image file
>
> Please check wether this happens.
>
> --- screen.getLastScreenImage()
> returns the BufferedImage (ScreenImage), that is stored with the screen
> object at the time of the last capture
>
> in your case the content that is used with the Pattern() should be the
> same as that with the screen.saveScreenCapture before, since no new
> capture could have changed the stored ScreenImage.
>
> Then you do a click with Selenium, which surely changes the screen
> content.
>
> with the following screen.click(p) you search a former screen content in
> a current screen content, that has changed and is not found of course.
>
> Even if it would have been found, all this would have benn the same as
> simply clicking the center of the screen.
>
> Since I have no idea, what you want to achieve, I can only say: revise
> your workflow
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/sikuli/+question/674435/+confirm?answer_id=2
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/sikuli/+question/674435
>
> You received this question notification because you asked the question.
>

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