Код: Выделить всё
UserAgentContext uacontext = new SimpleUserAgentContext();
DocumentBuilderImpl builder = new DocumentBuilderImpl(uacontext);
URL url = new URL(TEST_URI);
InputStream in = url.openConnection().getInputStream();
Reader reader = new InputStreamReader(in, "ISO-8859-1");
InputSourceImpl inputSource = new InputSourceImpl(reader, TEST_URI);
HTMLDocumentImpl d = (HTMLDocumentImpl) builder.parse(inputSource);
HTMLCollection images = d.getImages();
for (int i = 0; i < images.getLength(); i++) {
HTMLElementImpl n = (HTMLElementImpl) images.item(i);
AbstractCSS2Properties curr = n.getCurrentStyle();
System.out.println("Image " + i + ": " + curr.getPropertyValue("background-color"));
}
Спасибо
Подробнее здесь: https://stackoverflow.com/questions/182 ... l-renderer
Мобильная версия