Java-获取Web内容跳过中间页面以响应所需的响应



java我的情况是,我必须以表格提交结果获取响应的响应内容,但是b/s的流程并不像请求和响应那样简单。

Submit button pressed -> Display page processing wait timer -> Display quick advertisement page -> Display page result.

从"提交按钮"开始,我想拥有"显示页面结果"内容,然后跳过页面。

我有此示例代码,但仅以一种方式工作,发送请求并接收响应。

URL url;
InputStream is = null;
DataInputStream dis;
String line;
try {
    url = new URL("http://stackoverflow.com/");
    is = url.openStream();  // throws an IOException
    dis = new DataInputStream(new BufferedInputStream(is));
    while ((line = dis.readLine()) != null) {
        System.out.println(line);
    }
} catch (MalformedURLException mue) {
     mue.printStackTrace();
} catch (IOException ioe) {
     ioe.printStackTrace();
} finally {
    try {
        is.close();
    } catch (IOException ioe) {
        // nothing to see here
    }
}

有Java库可以为我做吗?预先感谢。

考虑尝试硒驱动器。可能是您要实施的内容。

最新更新