Java - jsoup 获取具有特定字符串的元素

Java - jsoup get element with specific string

我想要select一个与特定字符串相匹配的元素

<img src='http://iblink.ch/resized/sjg63ngi3h3g4a.jpg' alt='tree'>

因为我没有特定的 class 或 div 来触发我尝试使用 getElementsContainingOwnText("resized")

获取该元素的方法。 但是它没有找到它? 我也试试:getElementsContainingText 相同的输出:(

有人知道吗?

正文是标签外的部分:<tag attribute="value">Text</tag>

所以你想要 select 具有这样特定属性值的元素:

Elements els = doc.select("img[src*=resized]");

看看 CSS selectors as they are implemented in Jsoup