@Override
    public List<String> selectList(String text) {
        List<String> results = new ArrayList<String>();
        boolean first = true;
        for (Selector selector : selectors) {
            if (first) {
                results = selector.selectList(text);
                first = false;
            } else {
                List<String> resultsTemp = new ArrayList<String>();
                for (String result : results) {
                    resultsTemp.addAll(selector.selectList(result));
                }
                results = resultsTemp;
                if (results == null || results.size() == 0) {
                    return results;
                }
            }
        }
        return results;
    }
@Test
    public void testSelectList() {
        String htmlContent = "<!DOCTYPE html>\n" +
                "<html lang=\"en\">\n" +
                "<head>\n" +
                "    <meta charset=\"UTF-8\">\n" +
                "    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n" +
                "    <title>HTML with XPath</title>\n" +
                "</head>\n" +
                "<body>\n" +
                "    <div class=\"container\">\n" +
                "        <div class=\"item1\">Item 1</div>\n" +
                "        <div class=\"item2\">Item 2</div>\n" +
                "    </div>\n" +
                "</body>\n" +
                "</html>";
        List<Selector> selectors = new ArrayList<Selector>();
        selectors.add(new CssSelector("div"));
        selectors.add(new XpathSelector("//div[@class='item1']"));
        AndSelector andSelector = new AndSelector(selectors);
        List<String> result = andSelector.selectList(htmlContent);
        assertEquals("<div class=\"item1\">\n Item 1\n</div>", result.get(0));
    }