Search in sources :

Example 1 with CompositeLinkElementSelector

use of org.asqatasun.rules.elementselector.CompositeLinkElementSelector in project Asqatasun by Asqatasun.

the class Rgaa22Rule06021 method select.

@Override
protected void select(SSPHandler sspHandler) {
    ElementHandler<Element> tmpElHandler = new ElementHandlerImpl();
    /* the image link element selector */
    LinkElementSelector linkElementSelector = new LinkElementSelector(false);
    linkElementSelector.selectElements(sspHandler, tmpElHandler);
    for (Element el : linkElementSelector.getDecidableElements().get()) {
        if (doesElementHaveRequestedTargetAttribute(el)) {
            imageLinks.add(el);
        }
    }
    LinkElementSelector compositeLinkElementSelector = new CompositeLinkElementSelector(false, false);
    tmpElHandler.clean();
    compositeLinkElementSelector.selectElements(sspHandler, tmpElHandler);
    for (Element el : compositeLinkElementSelector.getDecidableElements().get()) {
        if (doesElementHaveRequestedTargetAttribute(el)) {
            imageLinks.add(el);
        }
    }
    linkSelected = imageLinks.get().size();
    ElementSelector formElementSelector = new SimpleElementSelector(HtmlElementStore.FORM_ELEMENT);
    tmpElHandler.clean();
    formElementSelector.selectElements(sspHandler, tmpElHandler);
    for (Element el : tmpElHandler.get()) {
        if (doesElementHaveRequestedTargetAttribute(el)) {
            formWithTargetHandler.add(el);
        }
    }
}
Also used : CompositeLinkElementSelector(org.asqatasun.rules.elementselector.CompositeLinkElementSelector) LinkElementSelector(org.asqatasun.rules.elementselector.LinkElementSelector) Element(org.jsoup.nodes.Element) ElementHandlerImpl(org.asqatasun.ruleimplementation.ElementHandlerImpl) CompositeLinkElementSelector(org.asqatasun.rules.elementselector.CompositeLinkElementSelector) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector) ElementSelector(org.asqatasun.rules.elementselector.ElementSelector) CompositeLinkElementSelector(org.asqatasun.rules.elementselector.CompositeLinkElementSelector) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector) LinkElementSelector(org.asqatasun.rules.elementselector.LinkElementSelector)

Example 2 with CompositeLinkElementSelector

use of org.asqatasun.rules.elementselector.CompositeLinkElementSelector in project Asqatasun by Asqatasun.

the class Rgaa22Rule06031 method select.

@Override
protected void select(SSPHandler sspHandler) {
    /* the image link element selector */
    LinkElementSelector compositeLinkElementSelector = new CompositeLinkElementSelector(false, true);
    ElementHandler<Element> elHandler = new ElementHandlerImpl();
    compositeLinkElementSelector.selectElements(sspHandler, elHandler);
    for (Element el : compositeLinkElementSelector.getDecidableElements().get()) {
        if (doesElementHaveRequestedTargetAttribute(el)) {
            compositeLinks.add(el);
        }
    }
    LinkElementSelector areaLinkElementSelector = new AreaLinkElementSelector(false);
    elHandler.clean();
    areaLinkElementSelector.selectElements(sspHandler, elHandler);
    for (Element el : areaLinkElementSelector.getDecidableElements().get()) {
        if (doesElementHaveRequestedTargetAttribute(el)) {
            compositeLinks.add(el);
        }
    }
}
Also used : AreaLinkElementSelector(org.asqatasun.rules.elementselector.AreaLinkElementSelector) CompositeLinkElementSelector(org.asqatasun.rules.elementselector.CompositeLinkElementSelector) AreaLinkElementSelector(org.asqatasun.rules.elementselector.AreaLinkElementSelector) LinkElementSelector(org.asqatasun.rules.elementselector.LinkElementSelector) Element(org.jsoup.nodes.Element) ElementHandlerImpl(org.asqatasun.ruleimplementation.ElementHandlerImpl) CompositeLinkElementSelector(org.asqatasun.rules.elementselector.CompositeLinkElementSelector)

Aggregations

ElementHandlerImpl (org.asqatasun.ruleimplementation.ElementHandlerImpl)2 CompositeLinkElementSelector (org.asqatasun.rules.elementselector.CompositeLinkElementSelector)2 LinkElementSelector (org.asqatasun.rules.elementselector.LinkElementSelector)2 Element (org.jsoup.nodes.Element)2 AreaLinkElementSelector (org.asqatasun.rules.elementselector.AreaLinkElementSelector)1 ElementSelector (org.asqatasun.rules.elementselector.ElementSelector)1 SimpleElementSelector (org.asqatasun.rules.elementselector.SimpleElementSelector)1