HtmlUnit can't retrieve page after downloading a file

后端 未结 1 1698
悲&欢浪女
悲&欢浪女 2021-02-10 16:42

I\'m having this weird problem with HtmlUnit in Java. I am using it to download some data from a website, the process is something like this:

1 - Login

2 - For e

1条回答
  •  醉话见心
    2021-02-10 17:10

    Just in case someone encounters the same problem, I found a workaround.Changing the line:

    InputStream is = _link.click().getWebResponse().getContentAsStream();
    

    to

    InputStream is = _link.openLinkInNewWindow().getWebResponse().getContentAsStream();
    

    seems to do the trick. Im having problems now when doing several iterations, sometimes it works, sometimes it doesn't but at least I have something now.

    0 讨论(0)
提交回复
热议问题