kazurayam / inspectus

The Inspectus library enables automated UI tests in Java/Groovy to perform "Visual Inspection" on top of the "materialstore"
Apache License 2.0
0 stars 0 forks source link

com.kazurayam.inspectus.materialize.selenium.WebPageMaterializingFunctions should implement methods that deals with "Element screenshot" #103

Closed kazurayam closed 10 months ago

kazurayam commented 10 months ago

v0.10.1, com.kazurayam.inspectus.materialize.selenium.WebPageMaterializingFunctions lacks methods that deals with "Element screenshots". Let's add them.

Why I want "Element Screenshot"? --- because I am developing https://github.com/kazurayam/ks_comparingElementScreenshots_using_Inspectus

Then, tell more detail of code.

For example inspectus4katalon-sample-project MyAdmin/processTargetList has the following fragment:

    // take and store the entire screenshot using AShot
    WebPageMaterializingFunctions pmf = new WebPageMaterializingFunctions(store, jobName, jobTimestamp)
    pmf.setScrollTimeout(1000)
    Map<String, String> attributes = ["step": String.format("%02d", index + 1)]

    // save as PNG
    Material png = pmf.storeEntirePageScreenshot.accept(driver, target, attributes)
    assert Files.exists(png.toPath())

This section takes a full page screenshot.

Now I want

Material png = pmf.storeElementScreenshot.accept(driver, target, attributes, By.xpath("//img[@id='apple']"))
kazurayam commented 10 months ago

done at v0.10.3