0

I have a list of pictures here:

     List<HtmlImage> picsa = (List<HtmlImage>) myPageww.getByXPath("//img[@alt]");

Then I save picture for picture:

 for (int i2 = 0; i2 < picsa.size(); i2++) {
                            File imageFile = new File(dir + "/" + "bilder/" + i2 + ".jpg");
                            imageFile.mkdirs();

                            picsa.get(i2).saveAs(imageFile);

}

now my problem is, the list of pictures have a src=url......$_00.JPG

and I must change the $_00.JPG to $_000.JPG

but if I try to replace it

HtmlImage imageCap = picsa.get(i2).asText().replace("$_00", "$_000");

I become an error

incompatible types: String cannot be converted to HtmlImage

What can I do?

NorthCat
  • 9,643
  • 16
  • 47
  • 50
Patrik
  • 23
  • 6

1 Answers1

0

asText() returns a String. replace() is a method of String and returns a String. You try to assign a String value to HtmlImage, which is not possible.

Your variable imageCap should be a String.

Rob Audenaerde
  • 19,195
  • 10
  • 76
  • 121