Capture Screenshot in webdriver

554 views
Skip to first unread message

Mayank

unread,
Jul 10, 2012, 8:42:23 AM7/10/12
to seleniu...@googlegroups.com
+++
PLEASE ANYONE LET ME KNOW HOW CAN I CAPTURE ENTIRE PROCESS SCREENSHOT IN SELENIUM WEB DRIVER ??

THANKS
MAYANK

Amira Mannaii

unread,
Jul 10, 2012, 8:47:36 AM7/10/12
to seleniu...@googlegroups.com
Hi ,
i found this  :
// RemoteWebDriver does not implement the TakesScreenshot class
        // if the driver does have the Capabilities to take a screenshot
        // then Augmenter will add the TakesScreenshot methods to the instance
        WebDriver augmentedDriver = new Augmenter().augment(driver);
        File screenshot = ((TakesScreenshot)augmentedDriver).
                            getScreenshotAs(OutputType.FILE);
you find it here http://seleniumhq.org/docs/04_webdriver_advanced.html#browser-startup-manipulation

2012/7/10 Mayank <maya...@gmail.com>
MAYANK

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/uIKhnYh0S1gJ.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.

Peter Gale

unread,
Jul 10, 2012, 8:58:32 AM7/10/12
to Selenium Users
GO TO GOOGLE.COM AND TYPE IN "selenium webdriver capture screenshot". FOLLOW THE FIST LINK.

BY THE WAY ... WHY ARE WE SHOUTING?


Date: Tue, 10 Jul 2012 05:42:23 -0700
From: maya...@gmail.com
To: seleniu...@googlegroups.com
Subject: [selenium-users] Capture Screenshot in webdriver

rajesh

unread,
Dec 28, 2012, 9:52:16 PM12/28/12
to seleniu...@googlegroups.com
Hello Mayank,

Use this code for taking screenshot:
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File("File Location\\File Name"),true);


Regards,
Rajesh

On Mon, Dec 24, 2012 at 2:57 PM, Geeta gondali <geetha...@gmail.com> wrote:


I have tried with this code but its not working for me. Its asking to rename the argument  "FILE" . I cannot able to resolve it. Please can u suggest me how to resolve it.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/V_awnxW7S_QJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 




Anand

unread,
Dec 29, 2012, 1:49:42 AM12/29/12
to seleniu...@googlegroups.com
Hi Rajesh,


I am getting following two errors:

1. Resource Path Location Type
TakesScreenshot cannot be resolved to a
type FunctionLibrary.java /selenium_demo/src/com/example/selenium line

2. Description Resource Path Location Type
The method copyFile(File, File) is undefined for the type
FileUtils FunctionLibrary.java /selenium_demo/src/com/example/selenium line

my code is :

public boolean TakeScreenShot(String TestCaseName)
{
String path;
try {
WebDriver augmentedDriver = new Augmenter().augment(mydriver);
File source =
((TakesScreenshot)augmentedDriver).getScreenshotAs(OutputType.FILE);
path = "./target/screenshots/" + source.getName();
FileUtils.copyFile(source, new File(path));
}
catch(IOException e) {
path = "Failed to capture screenshot: " + e.getMessage();
}
return true;
}


Regards,
Anand
Reply all
Reply to author
Forward
0 new messages