Search in sources :

Example 36 with Elements

use of org.jsoup.select.Elements in project Asqatasun by Asqatasun.

the class AttributePresenceCheckerTest method setUp.

@Override
public void setUp() {
    mockSSPHandler = createMock(SSPHandler.class);
    elements = new Elements();
    element = new Element(Tag.valueOf("div"), "");
    element.attr(AttributeStore.ALT_ATTR, "test");
    mockTestSolutionHandler = createMock(TestSolutionHandler.class);
    mockProcessRemarkService = createMock(ProcessRemarkService.class);
}
Also used : Element(org.jsoup.nodes.Element) EvidenceElement(org.asqatasun.entity.audit.EvidenceElement) SSPHandler(org.asqatasun.processor.SSPHandler) TestSolutionHandler(org.asqatasun.ruleimplementation.TestSolutionHandler) Elements(org.jsoup.select.Elements) ProcessRemarkService(org.asqatasun.service.ProcessRemarkService)

Example 37 with Elements

use of org.jsoup.select.Elements in project Asqatasun by Asqatasun.

the class Rgaa32016Rule110102 method putLabelElementHandlerIntoTheMap.

/**
     * This method linked each label which have an input child on a page to its
     * form in a map.
     */
private void putLabelElementHandlerIntoTheMap() {
    for (Element el : labelElementHandler.get()) {
        Element tmpElement = el.parent();
        while (tmpElement != null && StringUtils.isNotBlank(tmpElement.tagName())) {
            if (tmpElement.tagName().equals(FORM_ELEMENT)) {
                if (labelFormMap.containsKey(tmpElement)) {
                    Elements els = el.select(FORM_ELEMENT_WITH_ID_CSS_LIKE_QUERY);
                    if (!els.isEmpty()) {
                        labelFormMap.get(tmpElement).add(el);
                    }
                } else {
                    Elements els = el.select(FORM_ELEMENT_WITH_ID_CSS_LIKE_QUERY);
                    if (!els.isEmpty()) {
                        ElementHandler<Element> labelElement = new ElementHandlerImpl();
                        labelElement.add(el);
                        labelFormMap.put(tmpElement, labelElement);
                    }
                }
                break;
            }
            tmpElement = tmpElement.parent();
        }
    }
}
Also used : Element(org.jsoup.nodes.Element) ElementHandlerImpl(org.asqatasun.ruleimplementation.ElementHandlerImpl) Elements(org.jsoup.select.Elements)

Example 38 with Elements

use of org.jsoup.select.Elements in project Asqatasun by Asqatasun.

the class Rgaa22Rule11091 method select.

@Override
protected void select(SSPHandler sspHandler) {
    super.select(sspHandler);
    // once tables selected, we extract the caption child element of each 
    // to make the control
    Elements captionOnTable = new Elements();
    for (Element el : getSelectionWithoutMarkerHandler().get()) {
        captionOnTable.add(el.select(CAPTION_ELEMENT).first());
    }
    getSelectionWithoutMarkerHandler().clean().addAll(captionOnTable);
    Elements captionOnDataTable = new Elements();
    for (Element el : getSelectionWithMarkerHandler().get()) {
        captionOnDataTable.add(el.select(CAPTION_ELEMENT).first());
    }
    getSelectionWithMarkerHandler().clean().addAll(captionOnDataTable);
}
Also used : Element(org.jsoup.nodes.Element) Elements(org.jsoup.select.Elements)

Example 39 with Elements

use of org.jsoup.select.Elements in project Asqatasun by Asqatasun.

the class Rgaa22Rule03111 method select.

@Override
protected void select(SSPHandler sspHandler) {
    super.select(sspHandler);
    if (getElements().isEmpty()) {
        return;
    }
    Elements elementsWithUniqueId = new Elements();
    // on the page
    for (Element el : getElements().get()) {
        if (StringUtils.isNotEmpty(el.id().trim()) && CssLikeSelectorBuilder.getNumberOfElements(sspHandler, CssLikeSelectorBuilder.buildSelectorFromId(el.id())) == 1) {
            elementsWithUniqueId.add(el);
        }
    }
    // add the subset to the global selection
    getElements().clean().addAll(elementsWithUniqueId);
    if (elementsWithUniqueId.isEmpty()) {
        return;
    }
    for (Element el : elementsWithUniqueId) {
        String labelSelector = CssLikeSelectorBuilder.buildSelectorFromElementsAndAttributeValue(LABEL_ELEMENT, FOR_ATTR, el.id());
        if (CssLikeSelectorBuilder.getNumberOfElements(sspHandler, labelSelector) == 0) {
            this.elementsWithoutLabel.add(el);
        }
    }
}
Also used : Element(org.jsoup.nodes.Element) Elements(org.jsoup.select.Elements)

Example 40 with Elements

use of org.jsoup.select.Elements in project Asqatasun by Asqatasun.

the class Aw22Rule05051 method select.

@Override
protected void select(SSPHandler sspHandler) {
    super.select(sspHandler);
    // once tables selected, we extract the caption child element of each 
    // to make the control
    Elements captionOnTable = new Elements();
    for (Element el : getSelectionWithoutMarkerHandler().get()) {
        captionOnTable.add(el.select(CAPTION_ELEMENT).first());
    }
    getSelectionWithoutMarkerHandler().clean().addAll(captionOnTable);
    Elements captionOnDataTable = new Elements();
    for (Element el : getSelectionWithMarkerHandler().get()) {
        captionOnDataTable.add(el.select(CAPTION_ELEMENT).first());
    }
    getSelectionWithMarkerHandler().clean().addAll(captionOnDataTable);
}
Also used : Element(org.jsoup.nodes.Element) Elements(org.jsoup.select.Elements)

Aggregations

Elements (org.jsoup.select.Elements)218 Element (org.jsoup.nodes.Element)120 Document (org.jsoup.nodes.Document)78 Test (org.junit.Test)60 ArrayList (java.util.ArrayList)51 Configuration (com.vaadin.addon.charts.model.Configuration)27 IOException (java.io.IOException)26 URL (java.net.URL)13 ParseTest (org.jsoup.integration.ParseTest)11 File (java.io.File)9 List (java.util.List)9 HashMap (java.util.HashMap)7 SSPHandler (org.asqatasun.processor.SSPHandler)7 TestSolutionHandler (org.asqatasun.ruleimplementation.TestSolutionHandler)7 ProcessRemarkService (org.asqatasun.service.ProcessRemarkService)7 MalformedURLException (java.net.MalformedURLException)6 Logger (org.slf4j.Logger)6 LoggerFactory (org.slf4j.LoggerFactory)6 PlotOptionsLine (com.vaadin.addon.charts.model.PlotOptionsLine)5 RequestUtil (com.kyj.fx.voeditor.visual.util.RequestUtil)4