CaptureScreenshot in WebDriver

package com.automation.tests;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import utility.Helper;

public class CaptureScreenShotDemo {
 WebDriver driver;
 @Test
 public void facebookLogin(){
  driver.findElement(By.id("email")).sendKeys("9856451461");
  driver.findElement(By.id("pass")).sendKeys("qwerty123");
  driver.findElement(By.id("loginbutton")).click();
 }
 
 @AfterTest
 public void afterScreenshot() {
  Helper.captureScreenShort(driver, "facebook");
  driver.close();
 }
 
 @BeforeTest
 public void beforeScreenshot(){
  driver = Helper.launchBrowser("chrome");
  driver.get("http://facebook.com");
 }
}

No comments:

Post a Comment