How to take multiple screenshots in selenium webdriver?

  Рет қаралды 367

Programmer World

Programmer World

4 ай бұрын

In this video will see how to take/capture multiple screenshot or taking screenshots multiple times in a web application.
Video link for How to take a screenshot in selenium web driver:
• How to take a screensh...
I hope you like this video. For any questions, suggestions or appreciation please contact us at: programmerworld.co/contact/ or email at: programmerworld1990@gmail.com
Details:
programmerworld.co/selenium/h...
Code:
import java.io.File;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import com.google.common.io.Files;
public class captureScreenShot {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "directory path of chromedriver exe\\chromedriver.exe");
ChromeOptions op = new ChromeOptions();
op.setBinary("dierectory path of chrome exe\\chrome.exe");
op.addArguments("--remote-allow-origins=*");
WebDriver driver = new ChromeDriver(op);
driver.get("programmerworld.co/");
captureScreenShot.capSrShot(driver, "landingPage");
driver.findElement(By.xpath("//a[text()='Home']")).click();
captureScreenShot.capSrShot(driver, "HomePage");
}
public static void capSrShot(WebDriver driver, String name) throws IOException {
File f = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
Files.copy(f, new File("directory path to save screenshot\\"+name+".jpg"));
}
}
--

Пікірлер
Я обещал подарить ему самокат!
01:00
Vlad Samokatchik
Рет қаралды 9 МЛН
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 17 МЛН
World’s Largest Jello Pool
01:00
Mark Rober
Рет қаралды 105 МЛН
How to Handle Multiple Windows or Tabs in Selenium Webdriver
25:40
Mukesh otwani
Рет қаралды 170 М.
How to capture Screenshots for failed test cases in Selenium using TestNG Listeners
29:33
P6 - Attach screenshots to the extent reports | Extent Reports |
28:58
H Y R Tutorials
Рет қаралды 22 М.
Capture Screenshots using Selenium WebDriver | Selenium WebDriver |
19:44
How to Take Screenshot of  specific  Element in Selenium Web driver?
10:49
Crack Testing Interview
Рет қаралды 1 М.
Я обещал подарить ему самокат!
01:00
Vlad Samokatchik
Рет қаралды 9 МЛН