Java 使用WebClient和getpage

Java 使用WebClient和getpage,java,html,Java,Html,我正在尝试使用WebClient从Html页面获取信息,但无法获得正确的页面。它不会等待查询完成。 有人有主意吗它必须链接到我试图阅读的网站。对于其他网站,我的代码正在运行 这里是我用来获取Html页面的代码的摘录 public void initWebClient() { WebClient _webClient = new WebClient(BrowserVersion.FIREFOX_10); _webClient.getOptions().setJavaScriptEn

我正在尝试使用WebClient从Html页面获取信息,但无法获得正确的页面。它不会等待查询完成。 有人有主意吗它必须链接到我试图阅读的网站。对于其他网站,我的代码正在运行 这里是我用来获取Html页面的代码的摘录

public void initWebClient() {
    WebClient _webClient = new WebClient(BrowserVersion.FIREFOX_10);
    _webClient.getOptions().setJavaScriptEnabled(true);
    _webClient.getOptions().setThrowExceptionOnScriptError(false);
    _webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
    _webClient.waitForBackgroundJavaScript(10000);
    _webClient.waitForBackgroundJavaScriptStartingBefore(10000);
    _webClient.setCssEnabled(false);
    try {
        HtmlPage _pageRecherche = (HtmlPage) _webClient.getPage("https://www.blablacar.fr/trajets/paris/lyon/#?fn=PAris&fc=48.856614%7C2.352222&fcc=FR&fp=0&tn=LYON&tc=45.764043%7C4.835659&tcc=FR&tp=0&db=25%2F05%2F2017&sort=trip_date&order=asc&limit=10&page=1");
    } catch (FailingHttpStatusCodeException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
谢谢
Joe

在try-catch块内部使用此代码块,而不是在外部。如果失败,请检查其他操作系统

        WebClient webClient = new WebClient(BrowserVersion.FIREFOX_10);
        webClient.getOptions().setJavaScriptEnabled(false);
        webClient.getOptions().setUseInsecureSSL(true);
        HtmlPage page = (HtmlPage)     webClient.getPage("https://stackoverflow.com/users/login");
        System.out.println("Yeyy! :) Loaded Page!");

谢谢你的评论,但还是一样的问题。我认为这是特定于网站的:“你说的其他操作系统是什么意思?”?我已经试过Ubuntu和windows了