第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

HtmlUnit編碼

HtmlUnit編碼

守著一只汪 2023-11-01 22:32:14
每當(dāng)我單擊按鈕時(shí),我都會(huì)得到錯(cuò)誤的編碼。如何修復(fù)它?    package com.company;    import com.gargoylesoftware.htmlunit.*;    import com.gargoylesoftware.htmlunit.html.HtmlElement;    import com.gargoylesoftware.htmlunit.html.HtmlPage;    import org.apache.commons.logging.LogFactory;          import java.util.logging.Level;    public class Parsing {        public void connect() throws Exception {            LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");            java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF);            java.util.logging.Logger.getLogger("org.apache.commons.httpclient").setLevel(Level.OFF);            WebClient client = new WebClient(BrowserVersion.CHROME);            client.setAjaxController(new NicelyResynchronizingAjaxController());            client.getOptions().setThrowExceptionOnScriptError(false);            client.getOptions().setThrowExceptionOnFailingStatusCode(false);            String url = "https://auto.ru/cars/new/group/mercedes/e_klasse/20743577/20886691/?grouping_id=tech_param_id%3D20743577%2Ccomplectation_id%3D21225392&sort=fresh_relevance_1-desc&geo_radius=200";            HtmlPage page = client.getPage(url);            HtmlElement clickContact = (HtmlElement) page.getElementById("confirm-button");            page = clickContact.click();            client.waitForBackgroundJavaScript(10000);            System.out.println(page.asText());        }輸出:唷唷唷!...
查看完整描述

1 回答

?
慕森王

TA貢獻(xiàn)1777條經(jīng)驗(yàn) 獲得超3個(gè)贊

嘗試這個(gè)


public static void main(String[] args) throws IOException {

    String url = "https://auto.ru/cars/new/group/mercedes/e_klasse/20743577/20886691/?grouping_id=tech_param_id%3D20743577%2Ccomplectation_id%3D21225392&sort=fresh_relevance_1-desc&geo_radius=200";


    try (final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_60)) {

        webClient.getOptions().setThrowExceptionOnScriptError(false);


        HtmlPage page = webClient.getPage(url);


        HtmlElement clickContact = (HtmlElement) page.getElementById("confirm-button");

        page = clickContact.click();

        System.out.println("still running " + webClient.waitForBackgroundJavaScript(60_000));

        System.out.println(" ---- ");


        // the page content got changed via javascript

        // we like to get see the new content

        page = (HtmlPage) webClient.getCurrentWindow().getEnclosedPage();

        System.out.println(page.asText());

    }

}

我沒(méi)有得到全部?jī)?nèi)容,但得到了主要部分。


查看完整回答
反對(duì) 回復(fù) 2023-11-01
  • 1 回答
  • 0 關(guān)注
  • 202 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)