Skip to content

unexpexred SelectorParseException #43

@KEN-00

Description

@KEN-00

My query is:
( //script | //*[@id] | //*[@class] | //*[@for] )
My query works on Selenium. But when I try to run the query to get a list of jsoup Elements by the following function:

	public static void normaliseHtmlDom(Document htmlDom) throws ConfigInitializationException {
		Elements elements = htmlDom.getAllElements();
		Elements ignoredElements = Xsoup.compile(ConfigUtils.getInstance().getIgnoredXPathUnion()).evaluate(htmlDom).getElements();
		for(Element element : elements) {
			if(ignoredElements.contains(element)) {
				elements.remove(element);
			}
		}
		
//		normaliseElementsByTagNames(elements);
//		normaliseElementsByAttributeNames(elements);
	}

The following Exception is thrown:
org.jsoup.select.Selector$SelectorParseException: Could not parse query '( //script | //*[@id] | //*[@class] | //*[@for] )': unexpected token at '( //script | //*[@id] | //*[@class] | //*[@for] )'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions