Blog

  • Selenium Webdriver

    If We are using Selenium WebDriver to Automate our Software Web Application then sometime there is need to Capture the Screenshots using Selenium scripts because sometime we have to execute very large number of test cases and in these some test cases are fail so thats's why we need to check that why this test cases has failed.

    But before writing the Selenium script you have to add some special liberaries to take screenshot these are:-

    import java.io.File;

    import org.apache.commons.io.FileUtils;

    import org.openqa.selenium.OutputType;

    import org.openqa.selenium.TakesScreenshot;

    import org.testng.annotations.Test;

    This will help you in Execute the test cases and debug the code in more better way to next time. Here are some basic commands use to write the selenium scripts for capturing the screenshots

    File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);

    You can change the file path and name where you want to share 

    FileUtils.copyFile(scrFile, new File("D:\\screenshot.png"));

     

    THANKS

Tags: selenium

Mobile Applications

Video Content

Bigdata & NoSQL

SaaS Applications

Miscellaneous

Archives


Alexa Certified Site Stats for www.oodlestechnologies.com