Search in sources :

Example 1 with InputFormElementWithInplicitLabelSelector

use of org.asqatasun.rules.elementselector.InputFormElementWithInplicitLabelSelector 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 2 with InputFormElementWithInplicitLabelSelector

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

the class Rgaa32016Rule110101 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());
    // selection of the input form elements with explicit label
    ElementHandler<Element> inputFormWithAttrHandler = new ElementHandlerImpl();
    for (Element el : inputFormWithoutLabelHandler.get()) {
        if (el.hasAttr(TITLE_ATTR) || el.hasAttr(ARIA_LABEL_ATTR) || el.hasAttr(ARIA_LABELLEDBY_ATTR)) {
            inputFormWithAttrHandler.add(el);
        }
    }
    // remove all the input form elements with title, aria-label, or 
    // aria-labelledby attributes from the selection of the input form 
    // elements without label
    inputFormWithoutLabelHandler.removeAll(inputFormWithAttrHandler.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 3 with InputFormElementWithInplicitLabelSelector

use of org.asqatasun.rules.elementselector.InputFormElementWithInplicitLabelSelector 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 4 with InputFormElementWithInplicitLabelSelector

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

the class Rgaa30Rule110101 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());
    // selection of the input form elements with explicit label
    ElementHandler<Element> inputFormWithAttrHandler = new ElementHandlerImpl();
    for (Element el : inputFormWithoutLabelHandler.get()) {
        if (el.hasAttr(TITLE_ATTR) || el.hasAttr(ARIA_LABEL_ATTR) || el.hasAttr(ARIA_LABELLEDBY_ATTR)) {
            inputFormWithAttrHandler.add(el);
        }
    }
    // remove all the input form elements with title, aria-label, or
    // aria-labelledby attributes from the selection of the input form
    // elements without label
    inputFormWithoutLabelHandler.removeAll(inputFormWithAttrHandler.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)

Aggregations

ElementSelector (org.asqatasun.rules.elementselector.ElementSelector)4 InputFormElementWithExplicitLabelSelector (org.asqatasun.rules.elementselector.InputFormElementWithExplicitLabelSelector)4 InputFormElementWithInplicitLabelSelector (org.asqatasun.rules.elementselector.InputFormElementWithInplicitLabelSelector)4 ElementHandlerImpl (org.asqatasun.ruleimplementation.ElementHandlerImpl)3 SimpleElementSelector (org.asqatasun.rules.elementselector.SimpleElementSelector)3 Element (org.jsoup.nodes.Element)3