Skip to main content

Posts

Showing posts with the label screenshot

Capturing the screenshot via selenium

     We are discussing here about capturing a Screenshot via selenium, we have taken an example of FB page where if the title of FB page is different from what we have expected, then the screenshot should be captured Below is code for your understanding ...... import org.testng.annotations.Test; import java.io.File; import java.io.IOException; import java.util.concurrent.TimeUnit; import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Screenshotss { WebDriver driver ; @Test public void test() throws IOException {     System.setProperty( "Webdriver.chrome.driver" , "chromedriver" ); WebDriver driver = new ChromeDriver(); driver .manage().timeouts().implicitlyWait(5, TimeUnit. SECONDS ); //opening a facebook link     driver .get( "https://www.facebook.com" ); ...