Class StructuralVisualStateVertexFactory
- java.lang.Object
-
- com.crawljax.core.state.StateVertexFactory
-
- com.crawljax.stateabstractions.hybrid.StructuralVisualStateVertexFactory
-
public class StructuralVisualStateVertexFactory extends StateVertexFactory
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.LoggerLOGGERprivate BufferedImagescreenshotprivate static intTHUMBNAIL_HEIGHTprivate static intTHUMBNAIL_WIDTHprivate DHashvisualHashCalculator
-
Constructor Summary
Constructors Constructor Description StructuralVisualStateVertexFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private BufferedImagegetElementScreenshot(org.openqa.selenium.Rectangle boundingBox)private List<DOMElementWithVisualInfo>getElementsVisualInfo(EmbeddedBrowser browser, String strippedDom)private intgetIntValue(Object object)private org.openqa.selenium.RectanglegetNodeRectangle(EmbeddedBrowser browser, String xpath)private org.openqa.selenium.RectanglegetTextNodeRectangle(EmbeddedBrowser browser, org.apache.xerces.dom.TextImpl textNode)StateVertexnewStateVertex(int id, String url, String name, String dom, String strippedDom, EmbeddedBrowser browser)Defines a State.StateVertexForElementsWithVisualInfonewStateVertex(int id, String url, String name, String dom, String strippedDom, EmbeddedBrowser browser, DHash visualHashCalculator)private voidpopulateDOMNodesWithVisualInfo(EmbeddedBrowser browser, List<DOMElementWithVisualInfo> domElements, Node node)private static voidsaveImage(BufferedImage image, File screenshotFileToSave, boolean saveThumbnail)private booleanshouldDoVisualComaprison(Node node)private static voidwriteThumbNail(File target, BufferedImage screenshot)-
Methods inherited from class com.crawljax.core.state.StateVertexFactory
createIndex
-
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
THUMBNAIL_WIDTH
private static final int THUMBNAIL_WIDTH
- See Also:
- Constant Field Values
-
THUMBNAIL_HEIGHT
private static final int THUMBNAIL_HEIGHT
- See Also:
- Constant Field Values
-
screenshot
private BufferedImage screenshot
-
visualHashCalculator
private DHash visualHashCalculator
-
-
Method Detail
-
saveImage
private static void saveImage(BufferedImage image, File screenshotFileToSave, boolean saveThumbnail)
-
writeThumbNail
private static void writeThumbNail(File target, BufferedImage screenshot) throws IOException
- Throws:
IOException
-
newStateVertex
public StateVertex newStateVertex(int id, String url, String name, String dom, String strippedDom, EmbeddedBrowser browser)
Description copied from class:StateVertexFactoryDefines a State.- Specified by:
newStateVertexin classStateVertexFactoryurl- the current url of the statename- the name of the statedom- the current DOM tree of the browserstrippedDom- the stripped dom by the OracleComparators
-
newStateVertex
public StateVertexForElementsWithVisualInfo newStateVertex(int id, String url, String name, String dom, String strippedDom, EmbeddedBrowser browser, DHash visualHashCalculator)
-
getElementsVisualInfo
private List<DOMElementWithVisualInfo> getElementsVisualInfo(EmbeddedBrowser browser, String strippedDom)
-
populateDOMNodesWithVisualInfo
private void populateDOMNodesWithVisualInfo(EmbeddedBrowser browser, List<DOMElementWithVisualInfo> domElements, Node node)
-
shouldDoVisualComaprison
private boolean shouldDoVisualComaprison(Node node)
-
getElementScreenshot
private BufferedImage getElementScreenshot(org.openqa.selenium.Rectangle boundingBox)
-
getTextNodeRectangle
private org.openqa.selenium.Rectangle getTextNodeRectangle(EmbeddedBrowser browser, org.apache.xerces.dom.TextImpl textNode)
-
getNodeRectangle
private org.openqa.selenium.Rectangle getNodeRectangle(EmbeddedBrowser browser, String xpath)
-
getIntValue
private int getIntValue(Object object)
-
-