Question

I try in such way:

HtmlPage currentPage = (HtmlPage) webClient.getPage((urlList.get(i).toString()));

And have:

java.net.MalformedURLException: no protocol: HtmlImage[<img src="http://media.animewallpapers.com/wallpapers/misc/misc_164_t.jpg?m=21312126359&quot;"

What is a correct way?

Was it helpful?

Solution

In order to get the src attribute from an image you need to use the getSrcAttribute() method. Suppose myImage is an HtmlImage object, this code would output the src attribute to the console:

System.out.println(myImage.getSrcAttribute());

As a side note, casting an image as an HtmlPage will most likely throw an exception.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top