use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.
the class ImageElementSelectorTest method testSelectElements6_4.
/**
* Test of selectElements method, of class ImageElementSelector.
*/
public void testSelectElements6_4() {
LOGGER.debug("selectElements6-4");
Document doc = null;
try {
doc = Jsoup.parse(new File("src/test/resources/images/image-composite-4.html"), Charset.defaultCharset().displayName());
} catch (IOException ex) {
}
initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
ImageElementSelector instance = new ImageElementSelector(HtmlElementStore.IMG_ELEMENT, false, true);
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.isEmpty());
verifyMockContext();
}
use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.
the class SimpleElementSelectorTest method testSelectWidthNotWithinSvg.
/**
* Test of selectElements method, of class SimpleElementSelector.
*/
public void testSelectWidthNotWithinSvg() {
LOGGER.debug("select width attr not within svg and children");
Document doc = Jsoup.parse("<svg width=\"\" height=\"\">" + "</svg>" + "<svg text=\"bou\">" + "<text width=\"\" height=\"\" text=\"hop\"/>" + "</svg>");
initMockContext(CssLikeQueryStore.ELEMENT_WITH_WITDH_ATTR_NOT_IMG, doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
SimpleElementSelector instance = new SimpleElementSelector(CssLikeQueryStore.ELEMENT_WITH_WITDH_ATTR_NOT_IMG);
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.isEmpty());
verifyMockContext();
initMockContext(":not(svg)[text]:not(svg [text])", doc);
elementHandler = new ElementHandlerImpl();
instance = new SimpleElementSelector(":not(svg)[text]:not(svg [text])");
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.isEmpty());
verifyMockContext();
}
use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.
the class CaptchaElementSelectorTest method testNoCaptcha1.
/**
* Test of selectElements method, of class CaptchaElementSelector.
*/
public void testNoCaptcha1() {
LOGGER.debug("noCaptcha1");
Document doc = null;
try {
doc = Jsoup.parse(new File("src/test/resources/captcha/no-captcha1.html"), Charset.defaultCharset().displayName());
} catch (IOException ex) {
}
initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
CaptchaElementSelector instance = new CaptchaElementSelector(new SimpleElementSelector(HtmlElementStore.IMG_ELEMENT));
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.isEmpty());
verifyMockContext();
}
use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.
the class ImageElementSelectorTest method testSelectElements8_2.
/**
* Test of selectElements method, of class ImageElementSelector.
*/
public void testSelectElements8_2() {
LOGGER.debug("selectElements8-2");
Document doc = null;
try {
doc = Jsoup.parse(new File("src/test/resources/images/image-composite-2.html"), Charset.defaultCharset().displayName());
} catch (IOException ex) {
}
initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
ImageElementSelector instance = new ImageElementSelector(HtmlElementStore.IMG_ELEMENT, false, false);
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.get().size() == 1);
assertTrue(elementHandler.get().iterator().next().nodeName().equals(HtmlElementStore.IMG_ELEMENT));
verifyMockContext();
}
use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.
the class ImageElementSelectorTest method testSelectElements2_4.
/**
* Test of selectElements method, of class ImageElementSelector.
*/
public void testSelectElements2_4() {
LOGGER.debug("selectElements2-4");
Document doc = null;
try {
doc = Jsoup.parse(new File("src/test/resources/images/image-link-4.html"), Charset.defaultCharset().displayName());
} catch (IOException ex) {
}
initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
ImageElementSelector instance = new ImageElementSelector(HtmlElementStore.IMG_ELEMENT, false, true);
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.get().size() == 1);
assertTrue(elementHandler.get().iterator().next().nodeName().equals(HtmlElementStore.IMG_ELEMENT));
verifyMockContext();
}
Aggregations