本文整理汇总了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;
}