Search in sources :

Example 6 with ElementSelector

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

the class Aw22Rule08091 method select.

@Override
protected void select(SSPHandler sspHandler) {
    // Selection of all links without target
    ElementSelector linkWithoutTargetSelector = new SimpleElementSelector(LINK_WITHOUT_TARGET_CSS_LIKE_QUERY);
    linkWithoutTargetSelector.selectElements(sspHandler, linkWithoutTarget);
    // Selection of all links without target
    ElementSelector fielsetNotWithinFormSelector = new SimpleElementSelector(FIELDSET_NOT_WITHIN_FORM_CSS_LIKE_QUERY);
    fielsetNotWithinFormSelector.selectElements(sspHandler, fieldsetNotWithinForm);
    totalNumberOfElements = sspHandler.getTotalNumberOfElements();
}
Also used : SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector) ElementSelector(org.asqatasun.rules.elementselector.ElementSelector) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector)

Example 7 with ElementSelector

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

the class Aw22Rule11012 method select.

@Override
protected void select(SSPHandler sspHandler) {
    ElementSelector explicitLabelSelector = new InputFormElementWithExplicitLabelSelector();
    explicitLabelSelector.selectElements(sspHandler, labels);
    ElementSelector inplicitLabelSelector = new InputFormElementWithInplicitLabelSelector();
    inplicitLabelSelector.selectElements(sspHandler, labels);
}
Also used : InputFormElementWithExplicitLabelSelector(org.asqatasun.rules.elementselector.InputFormElementWithExplicitLabelSelector) InputFormElementWithInplicitLabelSelector(org.asqatasun.rules.elementselector.InputFormElementWithInplicitLabelSelector) ElementSelector(org.asqatasun.rules.elementselector.ElementSelector)

Example 8 with ElementSelector

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

the class Rgaa22Rule07091 method select.

@Override
protected void select(SSPHandler sspHandler) {
    // Selection of all links without target
    ElementSelector linkWithoutTargetSelector = new SimpleElementSelector(LINK_WITHOUT_TARGET_CSS_LIKE_QUERY);
    linkWithoutTargetSelector.selectElements(sspHandler, linkWithoutTarget);
    // Selection of all links without target
    ElementSelector fielsetNotWithinFormSelector = new SimpleElementSelector(FIELDSET_NOT_WITHIN_FORM_CSS_LIKE_QUERY);
    fielsetNotWithinFormSelector.selectElements(sspHandler, fieldsetNotWithinForm);
    totalNumberOfElements = sspHandler.getTotalNumberOfElements();
}
Also used : SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector) ElementSelector(org.asqatasun.rules.elementselector.ElementSelector) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector)

Example 9 with ElementSelector

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

the class SeoRule07051 method select.

@Override
protected void select(SSPHandler sspHandler) {
    ElementSelector selector = new SimpleElementSelector(H1_ELEMENT);
    selector.selectElements(sspHandler, h1Elements);
    // only keep one title when more than 2 are encountered
    selector = new SimpleElementSelector(TITLE_ELEMENT);
    selector.selectElements(sspHandler, titleElement);
    if (titleElement.get().size() > 1) {
        Element title = titleElement.get().iterator().next();
        titleElement.clean().add(title);
    }
}
Also used : Element(org.jsoup.nodes.Element) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector) ElementSelector(org.asqatasun.rules.elementselector.ElementSelector) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector)

Example 10 with ElementSelector

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

the class SeoRule08011 method select.

@Override
protected void select(SSPHandler sspHandler) {
    ElementSelector es = new SimpleElementSelector(FLASH_CONTENT_CSS_LIKE_QUERY);
    es.selectElements(sspHandler, decidableElements);
    es = new SimpleElementSelector(SCRIPT_ELEMENT);
    es.selectElements(sspHandler, notDecidableElements);
    Iterator<Element> iter = notDecidableElements.get().iterator();
    while (iter.hasNext()) {
        Element script = iter.next();
        if (!StringUtils.contains(script.html(), SWF_EXT)) {
            iter.remove();
        }
    }
}
Also used : Element(org.jsoup.nodes.Element) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector) ElementSelector(org.asqatasun.rules.elementselector.ElementSelector) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector)

Aggregations

ElementSelector (org.asqatasun.rules.elementselector.ElementSelector)17 SimpleElementSelector (org.asqatasun.rules.elementselector.SimpleElementSelector)16 Element (org.jsoup.nodes.Element)9 InputFormElementWithExplicitLabelSelector (org.asqatasun.rules.elementselector.InputFormElementWithExplicitLabelSelector)5 ElementHandlerImpl (org.asqatasun.ruleimplementation.ElementHandlerImpl)4 InputFormElementWithInplicitLabelSelector (org.asqatasun.rules.elementselector.InputFormElementWithInplicitLabelSelector)4 CompositeLinkElementSelector (org.asqatasun.rules.elementselector.CompositeLinkElementSelector)1 LinkElementSelector (org.asqatasun.rules.elementselector.LinkElementSelector)1