Re: Save image to desire location

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: Save image to desire location

Venugopal Gadiparthi

Hi Manoj,
Instead of taking screenshot  and crop from local system. Image available on the web page. We need to crop it while traversing to the application. How to do it?
Please find the below screenshot. 
Any suggestion?


On Tuesday, November 27, 2012 at 1:32:47 PM UTC+5:30, Manoj Hans wrote:
Hi folks,

I m just sharing the code for saving image to desire location may be it will help many of u.


public void DownloadImage(By by,String loc) throws IOException{
WebElement Image=driver.findElement(by);
File screen=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
        int width=Image.getSize().getWidth();
        int height=Image.getSize().getHeight();
        BufferedImage dest=img.getSubimage(Image.getLocation().getX(), Image.getLocation().getY(), width, height);
        ImageIO.write(dest, "png", screen);
        File file=new File(loc);

--Manoj Hans

You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit
For more options, visit