Search in sources :

Example 11 with SimpleElementSelector

use of org.asqatasun.rules.elementselector.SimpleElementSelector 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)

Example 12 with SimpleElementSelector

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

the class SeoRule06031 method select.

@Override
protected void select(SSPHandler sspHandler) {
    ElementSelector es = new SimpleElementSelector(TITLE_WITHIN_HEAD_CSS_LIKE_QUERY);
    es.selectElements(sspHandler, elementHandler);
}
Also used : SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector) ElementSelector(org.asqatasun.rules.elementselector.ElementSelector) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector)

Example 13 with SimpleElementSelector

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

the class Aw22Rule11011 method select.

@Override
protected void select(SSPHandler sspHandler) {
    // Selection of all the input form elements of the page
    ElementSelector elementSelector = new SimpleElementSelector(FORM_ELEMENT_CSS_LIKE_QUERY);
    elementSelector.selectElements(sspHandler, inputFormHandler);
    // the selection of the input form elements without label is initialised
    // with all the elements of the page, some elements will be removed later
    inputFormWithoutLabelHandler.addAll(inputFormHandler.get());
    // selection of the input form elements with explicit label
    ElementHandler<Element> inputFormLabelHandler = new ElementHandlerImpl();
    ElementSelector explicitLabelSelector = new InputFormElementWithExplicitLabelSelector(inputFormHandler);
    explicitLabelSelector.selectElements(sspHandler, inputFormLabelHandler);
    // remove all the input form elements with explicit label from 
    // the selection of the input form elements without label
    inputFormWithoutLabelHandler.removeAll(inputFormLabelHandler.get());
    // selection of the input form with inplicit label
    ElementSelector inplicitLabelSelector = new InputFormElementWithInplicitLabelSelector(inputFormHandler);
    inplicitLabelSelector.selectElements(sspHandler, inputFormLabelHandler);
    // remove all the input form elements with inplicit label from 
    // the selection of the input form elements without label
    inputFormWithoutLabelHandler.removeAll(inputFormLabelHandler.get());
}
Also used : InputFormElementWithExplicitLabelSelector(org.asqatasun.rules.elementselector.InputFormElementWithExplicitLabelSelector) InputFormElementWithInplicitLabelSelector(org.asqatasun.rules.elementselector.InputFormElementWithInplicitLabelSelector) Element(org.jsoup.nodes.Element) ElementHandlerImpl(org.asqatasun.ruleimplementation.ElementHandlerImpl) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector) ElementSelector(org.asqatasun.rules.elementselector.ElementSelector) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector)

Example 14 with SimpleElementSelector

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

the class Aw22Rule11013 method select.

@Override
protected void select(SSPHandler sspHandler) {
    ElementSelector elementSelector = new SimpleElementSelector(FORM_LABEL_WITH_INNER_FORM_ELEMENT_CSS_LIKE_QUERY);
    elementSelector.selectElements(sspHandler, innerControlLabelElements);
    ElementSelector explicitLabelSelector = new InputFormElementWithExplicitLabelSelector();
    explicitLabelSelector.selectElements(sspHandler, explicitLabelElements);
}
Also used : InputFormElementWithExplicitLabelSelector(org.asqatasun.rules.elementselector.InputFormElementWithExplicitLabelSelector) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector) ElementSelector(org.asqatasun.rules.elementselector.ElementSelector) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector)

Example 15 with SimpleElementSelector

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

the class Aw22Rule08031 method select.

@Override
protected void select(SSPHandler sspHandler) {
    new SimpleElementSelector(HTML_WITH_LANG_CSS_LIKE_QUERY).selectElements(sspHandler, htmlWithLangHandler);
    if (!htmlWithLangHandler.isEmpty()) {
        return;
    }
    new SimpleElementSelector(ELEMENT_WITH_LANG_ATTR_CSS_LIKE_QUERY).selectElements(sspHandler, elementWithLang);
    new SimpleElementSelector(ELEMENT_WITHOUT_LANG_ATTR_CSS_LIKE_QUERY).selectElements(sspHandler, elementWithoutLang);
    removeElementWithParentWithLangAttr();
}
Also used : SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector)

Aggregations

SimpleElementSelector (org.asqatasun.rules.elementselector.SimpleElementSelector)28 ElementSelector (org.asqatasun.rules.elementselector.ElementSelector)16 Element (org.jsoup.nodes.Element)13 ElementHandlerImpl (org.asqatasun.ruleimplementation.ElementHandlerImpl)9 Nomenclature (org.asqatasun.entity.reference.Nomenclature)4 InputFormElementWithExplicitLabelSelector (org.asqatasun.rules.elementselector.InputFormElementWithExplicitLabelSelector)4 InputFormElementWithInplicitLabelSelector (org.asqatasun.rules.elementselector.InputFormElementWithInplicitLabelSelector)3 TestSolution (org.asqatasun.entity.audit.TestSolution)1 ElementHandler (org.asqatasun.ruleimplementation.ElementHandler)1 CompositeLinkElementSelector (org.asqatasun.rules.elementselector.CompositeLinkElementSelector)1 LinkElementSelector (org.asqatasun.rules.elementselector.LinkElementSelector)1 MultipleElementSelector (org.asqatasun.rules.elementselector.MultipleElementSelector)1