Verify element action with screen shot in selenium 4 - java

public static void verify_element_withScreenShot__(WebElement element,String NameOfElement) throws IOException {

screenshot_Path = AutoTest_PropertiesLoader.get_property("config", "screenshot_Path");

try {

TakesScreenshot screenshot = element;

File src = screenshot.getScreenshotAs(OutputType.FILE);

FileUtils.copyFile(src, new File(screenshot_Path+"/stepVerification/"+NameOfElement+ ".png"));

} catch (Exception e) {

System.out.println("Error occurred while taking screenshot " + e.getMessage());

}

}

To view or add a comment, sign in

More articles by Arslan Ahmad

  • Get element in selenium

    This article is about locating element using selenium command and java-script-executor, this method will find element…

  • UI Testing Checklist

    The Graphical User Interface of an application is very important and therefore UI testing is even more important. If…

    1 Comment
  • Types of testing

    Acceptance testing This type of test is done in order to determine if a product’s feature matches its requirements…

    2 Comments
  • Execute JMeter load tests using command line

    Create JMeter test and open command line "window + R" will open run mode, insert "cmd" and hit "Enter". Create a folder…

  • Wait in selenium 4

    //FLUENT WAIT public static FluentWait driver_wait__(int seconds) { FluentWait waitF = new FluentWait(driver)…

  • Using XPath for locating elements in HTML

    Using XPath for locating elements in HTML We have our own way of introducing (explaining) XPath to the trainees in our…

  • Agile QA

    Agile methodology is increasingly finding its place in software projects across the world. Statistics show 88% of…

Explore content categories