本文整理匯總了Java中com.gargoylesoftware.htmlunit.WebClient.setAjaxController方法的典型用法代碼示例。如果您正苦於以下問題:Java WebClient.setAjaxController方法的具體用法?Java WebClient.setAjaxController怎麽用?Java WebClient.setAjaxController使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.gargoylesoftware.htmlunit.WebClient
的用法示例。
在下文中一共展示了WebClient.setAjaxController方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Server
import com.gargoylesoftware.htmlunit.WebClient; //導入方法依賴的package包/類
public Server()throws IOException{
browser = new WebClient(BrowserVersion.CHROME);
problems = new ArrayList<>();
done = false;
isSubmitting = false;
user_name = "XC2";
pass_word = "donthackme";
work_list = new ArrayList<>();
users_data = new HashMap<>();
application = Executors.newCachedThreadPool();
//the buffer can be 100 at max (may be adjusted if needed)
buffer_queue = new LinkedBlockingQueue<>(100);
//some browser intitialization to increase efficiency (the cookies part is essential)
browser.getOptions().setUseInsecureSSL(true);
browser.getOptions().setJavaScriptEnabled(false);
browser.getOptions().setCssEnabled(false);
browser.getOptions().setThrowExceptionOnScriptError(false);
browser.getCookieManager().setCookiesEnabled(true);
browser.setAjaxController(new NicelyResynchronizingAjaxController());
}
示例2: create
import com.gargoylesoftware.htmlunit.WebClient; //導入方法依賴的package包/類
public static WebClient create(String host,int port) {
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.http.client").setLevel(
Level.OFF);
// LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log","org.apache.commons.logging.impl.NoOpLog");
// java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF);
WebClient webClient = new WebClient(BrowserVersion.FIREFOX_17,host,port);
webClient.getOptions().setUseInsecureSSL(true);
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
webClient.getOptions().setCssEnabled(true);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.getOptions().setTimeout(60000);
webClient.setJavaScriptTimeout(60000);
webClient.waitForBackgroundJavaScript(120000);
return webClient;
}
示例3: Server
import com.gargoylesoftware.htmlunit.WebClient; //導入方法依賴的package包/類
public Server()throws IOException{
browser = new WebClient(BrowserVersion.CHROME);
problems = new ArrayList<>();
done = false;
isSubmitting = false;
user_name = "XC2";
pass_word = "donthackme";
application = Executors.newCachedThreadPool();
//the buffer can be 100 at max (may be adjusted if needed)
buffer_queue = new LinkedBlockingQueue<>(100);
network = new Network_Server(this, this.port, this.max_clients);
//some browser intitialization to increase efficiency (the cookies part is essential)
browser.getOptions().setUseInsecureSSL(true);
browser.getOptions().setJavaScriptEnabled(false);
browser.getOptions().setCssEnabled(false);
browser.getOptions().setThrowExceptionOnScriptError(false);
browser.getCookieManager().setCookiesEnabled(true);
browser.setAjaxController(new NicelyResynchronizingAjaxController());
}
示例4: newClient
import com.gargoylesoftware.htmlunit.WebClient; //導入方法依賴的package包/類
protected static WebClient newClient()
{
final WebClient webClient = new WebClient();
webClient.getOptions().setJavaScriptEnabled( false );
webClient.getOptions().setCssEnabled( false );
webClient.getOptions().setAppletEnabled( false );
webClient.getOptions().setThrowExceptionOnFailingStatusCode( false );
webClient.setAjaxController( new NicelyResynchronizingAjaxController() );
return webClient;
}