本文整理汇总了Java中com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController类的典型用法代码示例。如果您正苦于以下问题:Java NicelyResynchronizingAjaxController类的具体用法?Java NicelyResynchronizingAjaxController怎么用?Java NicelyResynchronizingAjaxController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NicelyResynchronizingAjaxController类属于com.gargoylesoftware.htmlunit包,在下文中一共展示了NicelyResynchronizingAjaxController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Server
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的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.NicelyResynchronizingAjaxController; //导入依赖的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: setUp
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws InterruptedException {
log.debug("setUp");
webClient = new WebClient();
WebClientOptions options = webClient.getOptions();
options.setPrintContentOnFailingStatusCode(true);
options.setJavaScriptEnabled(true);
webClient.setHTMLParserListener(HTMLParserListener.LOG_REPORTER);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
ProxyConfig proxy = new ProxyConfig("p-goodway.rd.francetelecom.fr", 3128);
proxy.addHostsToProxyBypass("127.0.0.1");
options.setProxyConfig(proxy);
}
示例4: setupBrowser
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的package包/类
@Before
public void setupBrowser() {
webClient = new WebClient(BrowserVersion.CHROME);
webClient.getOptions().setCssEnabled(true);
webClient.setCssErrorHandler(new SilentCssErrorHandler());
webClient.getOptions().setThrowExceptionOnFailingStatusCode(true);
webClient.getOptions().setThrowExceptionOnScriptError(true);
webClient.getOptions().setRedirectEnabled(true);
webClient.getOptions().setAppletEnabled(false);
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setPopupBlockerEnabled(true);
webClient.getOptions().setTimeout(TIMEOUT);
webClient.getOptions().setPrintContentOnFailingStatusCode(false);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.setAlertHandler(new AlertHandler() {
public void handleAlert(Page page, String message) {
System.err.println("[alert] " + message);
}
});
webClient.waitForBackgroundJavaScript(TIMEOUT);
}
示例5: getDefaultWebClient
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的package包/类
private WebClient getDefaultWebClient() {
final WebClient webClient = new WebClient(FIREFOX_45);
webClient.addRequestHeader(ACCEPT, "text/html");
webClient.setCredentialsProvider(getFedoraAdminCredentials());
webClient.waitForBackgroundJavaScript(1000);
webClient.waitForBackgroundJavaScriptStartingBefore(10000);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
//Suppress warning from IncorrectnessListener
webClient.setIncorrectnessListener(new SuppressWarningIncorrectnessListener());
//Suppress css warning with the silent error handler.
webClient.setCssErrorHandler(new SilentCssErrorHandler());
return webClient;
}
示例6: Server
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的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());
}
示例7: newClient
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的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;
}
示例8: onAuthorization
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的package包/类
@Override
protected void onAuthorization(AuthorizationCodeRequestUrl authorizationUrl) throws IOException {
monitor.subTask("Please open the following address in your browser:" + authorizationUrl);
// use an old browser so that we see the old sign-in page
try (final WebClient webClient = new WebClient(INTERNET_EXPLORER_6)) {
webClient.getOptions().setJavaScriptEnabled(true);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.getOptions().setThrowExceptionOnScriptError(false);
HtmlPage nextPage = signIn(webClient, authorizationUrl.build());
if (isSelectChallengePage(nextPage)) {
nextPage = selectEmailRecoveryAsSignInChallenge(webClient, nextPage);
System.out.println("Selected recovery email confirmation as challenge");
nextPage = confirmRecoveryEmail(webClient, nextPage);
System.out.println("Used recovery email to confirm it's us");
allowAccess(webClient, nextPage);
} else if (isConfirmRecoveryEmailPage(nextPage)) {
nextPage = confirmRecoveryEmail(webClient, nextPage);
System.out.println("Used recovery email to confirm it's us");
allowAccess(webClient, nextPage);
} else {
allowAccess(webClient, nextPage);
}
}
if (authorizationListener != null) {
authorizationListener.onAuthorization();
}
}
示例9: updateWebClient
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的package包/类
public void updateWebClient() {
WebClient webClient = getWebClient();
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setThrowExceptionOnScriptError(true);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.waitForBackgroundJavaScript(10000);
}
示例10: runTest
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的package包/类
private void runTest(File file) throws Exception {
setWebClient(new WebClient(BrowserVersion.FIREFOX_24));
WebClient client = getWebClient();
client.getOptions().setJavaScriptEnabled(true);
client.getOptions().setThrowExceptionOnScriptError(false);
client.setAjaxController(new NicelyResynchronizingAjaxController());
client.waitForBackgroundJavaScript(1000);
// pass the login filter
// need to change to the testing port 8090
HtmlPage page = client.getPage(new URL(getBaseURL() + "/TimeDetail.do"));
HtmlForm form = page.getFormByName("login-form");
HtmlSubmitInput button = form.getInputByName("login");
page = button.click();
// run the unit test
// need to change to the testing port 8090
page = client.getPage(new URL("http://localhost:8080/tk-dev/qunit/" + file.getName()));
synchronized (page) {
page.wait(5000);
}
HtmlUnitUtil.createTempFile(page);
HtmlElement element = page.getHtmlElementById("qunit-tests");
if (element.asText().indexOf("0 tests of 0") != -1)
failures.add(file.getName() + " - No tests were run - " + element.asText());
else if (element.asText().indexOf("0 failed") == -1)
failures.add(file.getName() + " - " + element.asText());
}
示例11: updateWebClient
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的package包/类
public void updateWebClient() {
WebClient webClient = getWebClient();
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.waitForBackgroundJavaScript(10000);
}
示例12: updateWebClient
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的package包/类
public void updateWebClient() {
WebClient webClient = getWebClient();
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setThrowExceptionOnScriptError(true);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.waitForBackgroundJavaScript(10000);
}
示例13: getUserIdFromUserName
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的package包/类
public int getUserIdFromUserName(String userName) {
manager.setCssEnabled(false);
manager.setJavaScriptEnabled(false);
manager.setAjaxController(new NicelyResynchronizingAjaxController());
manager.setRedirectEnabled(true);
manager.setThrowExceptionOnFailingStatusCode(false);
manager.setThrowExceptionOnScriptError(false);
manager.setPrintContentOnFailingStatusCode(false);
manager.setCssEnabled(false);
try {
HtmlPage page = manager
.getPage("http://www.roblox.com/User.aspx?username="
+ userName);
if (page.getUrl().equals(
"http://www.roblox.com/Error/DoesntExist.aspx")) {
System.out.println("UserId does not exist.");
} else {
manager.closeAllWindows();
return Integer.parseInt(page.getUrl().toString().substring(35));
}
} catch (Exception e) {
System.out.println("Error getting user page");
}
manager.closeAllWindows();
return -1;
}
示例14: ExtractInfoWithHtmlUnit
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的package包/类
private ExtractInfoWithHtmlUnit()
{
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.getOptions().setThrowExceptionOnScriptError(false);
//webClient.getOptions().setThrowExceptionOnFailingStatusCode(true);
webClient.getOptions().setCssEnabled(false);
webClient.getOptions().setJavaScriptEnabled(true);
//webClient.getOptions().setDoNotTrackEnabled(true);
webClient.getOptions().setTimeout(300000);
webClient.waitForBackgroundJavaScript(5000);
}
示例15: doConfigureWebDriverModule
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; //导入依赖的package包/类
@Override
protected void doConfigureWebDriverModule() {
// Create an extra binding for the WebDriverEventListener using a qualifier annotation.
// The Multibinder for the event listener will then link to this binding so it may be overridden.
// This is necessary because multibindings themselves cannot be overridden.
bind(WebDriverEventListener.class).annotatedWith(DefaultWebDriverEventListener.class).to(
JFunkWebDriverEventListener.class);
bindWebDriverEventListener().to(Key.get(WebDriverEventListener.class, DefaultWebDriverEventListener.class));
bind(BrowserVersion.class).toInstance(BrowserVersion.BEST_SUPPORTED);
bind(AjaxController.class).to(NicelyResynchronizingAjaxController.class);
bind(DumpFileCreator.class);
bindWebDriver(WebConstants.WEBDRIVER_HTMLUNIT, HtmlUnitDriverProvider.class);
bindWebDriver(WebConstants.WEBDRIVER_FIREFOX, FirefoxDriverProvider.class);
bindWebDriver(WebConstants.WEBDRIVER_CHROME, ChromeDriverProvider.class);
bindWebDriver(WebConstants.WEBDRIVER_INTERNET_EXPLORER, InternetExplorerDriverProvider.class);
bindWebDriver(WebConstants.WEBDRIVER_REMOTE, RemoteWebDriverProvider.class);
bindDisposable(Key.get(WebDriver.class)).to(WebDriverDisposable.class);
bind(new TypeLiteral<Map<String, DesiredCapabilities>>() {
//
}).toProvider(CapabilitiesProvider.class);
bind(WebDriver.class).toProvider(WebDriverProvider.class).in(scopeAnnotationClass);
bind(WebElementFinder.class).toProvider(WebElementFinderProvider.class).in(scopeAnnotationClass);
bind(FormInputHandler.class).toProvider(FormInputHandlerProvider.class).in(scopeAnnotationClass);
bind(WebDriverTool.class).in(scopeAnnotationClass);
}