Search in sources :

Example 1 with SimpleElementSelector

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

the class AbstractUniqueElementSiteRuleImplementation method extractRelCanonical.

/**
     * 
     * @param sspHandler
     * @param prs
     * @param remarks 
     */
private void extractRelCanonical(SSPHandler sspHandler, ProcessRemarkService prs, Collection<ProcessRemark> remarks) {
    ElementSelector relCanonicalSelector = new SimpleElementSelector(CssLikeQueryStore.REL_CANONICAL_CSS_LIKE_QUERY);
    ElementHandler<Element> relCan = new ElementHandlerImpl();
    relCanonicalSelector.selectElements(sspHandler, relCan);
    if (relCan.get().size() != 1) {
        return;
    }
    String relValue = ((Element) relCan.get().iterator().next()).absUrl(AttributeStore.HREF_ATTR);
    if (!StringUtils.equalsIgnoreCase(relValue, sspHandler.getSSP().getURI())) {
        remarks.add(prs.createConsolidationRemark(TestSolution.PASSED, REL_CAN_VALUE_REMARK_MSG, relValue, sspHandler.getSSP().getURI()));
    }
}
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 2 with SimpleElementSelector

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

the class AbstractAriaPageRuleWithSelectorAndCheckerImplementation method select.

/**
     * Perform the selection using the {@link ElementSelector}
     * 
     * @param sspHandler
     */
@Override
protected void select(SSPHandler sspHandler) {
    ElementSelector es = new SimpleElementSelector("[^aria]");
    es.selectElements(sspHandler, ariaElementHandler);
    if (ariaElementHandler.isEmpty()) {
        return;
    }
    super.select(sspHandler);
}
Also used : SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector) ElementSelector(org.asqatasun.rules.elementselector.ElementSelector) SimpleElementSelector(org.asqatasun.rules.elementselector.SimpleElementSelector)

Example 3 with SimpleElementSelector

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

the class Rgaa30Rule080901 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 4 with SimpleElementSelector

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

the class Rgaa32016Rule060501 method select.

@Override
protected void select(SSPHandler sspHandler) {
    ElementSelector elementsSelector = new SimpleElementSelector(NOT_ANCHOR_LINK_CSS_LIKE_QUERY);
    elementsSelector.selectElements(sspHandler, linksHandler);
    for (Element el : linksHandler.get()) {
        if (StringUtils.isBlank(el.text()) && el.getElementsByAttributeValueMatching(ALT_ATTR, "^(?=\\s*\\S).*$").isEmpty()) {
            emptyLinksHandler.add(el);
        }
    }
}
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 5 with SimpleElementSelector

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

the class Rgaa32016Rule080901 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)

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