當前位置: 首頁>>代碼示例>>Java>>正文


Java BrowserVersion.FIREFOX_38屬性代碼示例

本文整理匯總了Java中com.gargoylesoftware.htmlunit.BrowserVersion.FIREFOX_38屬性的典型用法代碼示例。如果您正苦於以下問題:Java BrowserVersion.FIREFOX_38屬性的具體用法?Java BrowserVersion.FIREFOX_38怎麽用?Java BrowserVersion.FIREFOX_38使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.gargoylesoftware.htmlunit.BrowserVersion的用法示例。


在下文中一共展示了BrowserVersion.FIREFOX_38屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getLocker

public List<LockerObject> getLocker(boolean previewLink) {
	List<LockerObject> list = new ArrayList<>();
	try {
		WebClient webClient = new WebClient(BrowserVersion.FIREFOX_38);
		webClient.setCookieManager(cookieManager);

		HtmlPage page = webClient.getPage("https://pdsb.elearningontario.ca/d2l/lms/locker/locker.d2l?ou=8340");

		for (Object object : page.getByXPath("//a")) {
			DomElement de = (DomElement) object;
			if (de.asXml().toString().contains("/d2l/common/viewFile.d2lfile/Database/")) {
				if (!previewLink) {
					list.add(new LockerObject(de.getAttribute("title").replace("Open ", ""),  "https://pdsb.elearningontario.ca" + de.getAttribute("href").replace("&display=1", "")));
				} else {
					list.add(new LockerObject(de.getAttribute("title").replace("Open ", ""),  "https://pdsb.elearningontario.ca" + de.getAttribute("href")));

				}
			}
		}

		webClient.close();
	} catch (Exception e) {
		e.printStackTrace();
	}
	return list;
}
 
開發者ID:zeshan321,項目名稱:Project-D2L,代碼行數:26,代碼來源:D2LHook.java

示例2: getNotifications

public List<NotificationObject> getNotifications(String ID) throws InvaildCourseException {
	List<NotificationObject> list = new ArrayList<>();
	try {
		WebClient webClient = new WebClient(BrowserVersion.FIREFOX_38);
		webClient.setCookieManager(cookieManager);

		UnexpectedPage page = webClient.getPage("https://pdsb.elearningontario.ca/d2l/MiniBar/" + ID + "/ActivityFeed/GetAlerts?Category=1&_d2l_prc%24headingLevel=2&_d2l_prc%24scope=&_d2l_prc%24hasActiveForm=false&isXhr=true&requestId=2");
		NotificationFormater notificationFormater = new NotificationFormater(page.getWebResponse().getContentAsString());
		
		webClient.close();
		
		for (Object object: notificationFormater.getNotifications()) {
			DomElement de = (DomElement) object;
			String[] split = de.asText().split("\\n");
			
			list.add(new NotificationObject(split[0].trim(), split[1].trim(), split[2].trim()));
		}
	} catch (Exception e) {
		throw new InvaildCourseException("Invaild Course ID");
	}
	
	return list;
}
 
開發者ID:zeshan321,項目名稱:Project-D2L,代碼行數:23,代碼來源:D2LHook.java

示例3: getJavascriptHTML

public static String getJavascriptHTML(String urlToRead, int jsTimeout) {
	//Otherwise we will get flooded with log warnings -.-
	java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(java.util.logging.Level.OFF);

	try (WebClient webClient = new WebClient(BrowserVersion.FIREFOX_38)) {
		webClient.getOptions().setJavaScriptEnabled(true);
		webClient.getOptions().setThrowExceptionOnFailingStatusCode(true);
		webClient.getOptions().setThrowExceptionOnScriptError(false);

		HtmlPage page = webClient.getPage(urlToRead);

		webClient.waitForBackgroundJavaScript(jsTimeout);

		return page.asXml();
	} catch (FailingHttpStatusCodeException | IOException e) {
		CCLog.addError(LocaleBundle.getFormattedString("LogMessage.CouldNotGetHTML", urlToRead), e);
		return "";
	}
}
 
開發者ID:Mikescher,項目名稱:jClipCorn,代碼行數:19,代碼來源:HTTPUtilities.java

示例4: initial

private void initial() {
	this.webClient = new WebClient(BrowserVersion.FIREFOX_38);
	//this.webClient.getOptions().setProxyConfig(new ProxyConfig("cn-proxy.jp.oracle.com", 80));
	this.webClient.getCookieManager().setCookiesEnabled(true);//must enabled cookies
	this.webClient.getOptions().setJavaScriptEnabled(false);
	this.webClient.getOptions().setCssEnabled(false);
	this.webClient.getOptions().setThrowExceptionOnScriptError(false);
	this.webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
	this.webClient.getOptions().setTimeout(35000);
}
 
開發者ID:alexmao86,項目名稱:weixinmp4j,代碼行數:10,代碼來源:WeixinmpWebSession.java

示例5: getHtmlUnitWebDriver

/**
 * Default implementation of getting a local HTMLUnit Driver
 * 
 * @return {@link WebDriver} for HTMLUnit
 */
protected WebDriver getHtmlUnitWebDriver()
{
  // Set to firefox 24 to emulate a friendly javascript engine
  HtmlUnitDriver driver = new HtmlUnitDriver(BrowserVersion.FIREFOX_38);
  driver.setJavascriptEnabled(true);
  return driver;
}
 
開發者ID:partnet,項目名稱:seauto,代碼行數:12,代碼來源:AbstractConfigurableDriverProvider.java

示例6: getCourseContent

public List<ContentObject> getCourseContent(String ID) throws InvaildCourseException {
	List<ContentObject> list = new ArrayList<>();
	try {
		WebClient webClient = new WebClient(BrowserVersion.FIREFOX_38);
		webClient.setCookieManager(cookieManager);

		HtmlPage page = webClient.getPage("https://pdsb.elearningontario.ca/d2l/le/content/" + ID + "/Home");

		for (Object object : page.getByXPath("//li[@class='d2l-le-TreeAccordionItem d2l-le-TreeAccordionItem-Root']")) {
			DomElement de = (DomElement) object;
			if (de.getId().contains("D2L_LE_Content_TreeBrowser_D2L.LE.Content.ContentObject.ModuleCO-")) {
				String[] split = de.asText().split("\\n");
				List<String> ob = new ArrayList<>();

				for (int i = 1; i < split.length; i++) {
					ob.add(split[i]);
				}

				list.add(new ContentObject(split[0], ob));
			}
		}
		webClient.close();
	} catch (Exception e) {
		throw new InvaildCourseException("Invaild Course ID");
	}
	return list;
}
 
開發者ID:zeshan321,項目名稱:Project-D2L,代碼行數:27,代碼來源:D2LHook.java

示例7: getHtmlUnitBrowserVersion

@SuppressWarnings("deprecation")
    private BrowserVersion getHtmlUnitBrowserVersion() {
		if (htmlUnitBrowserVersion.equals("FIREFOX_38"))
			return BrowserVersion.FIREFOX_38;
//		else if(htmlUnitBrowserVersion.equals("FIREFOX_10"))
//			return BrowserVersion.FIREFOX_10;
//		else if(htmlUnitBrowserVersion.equals("FIREFOX_17"))
//            return BrowserVersion.FIREFOX_17;
		else if(htmlUnitBrowserVersion.equals("CHROME"))
            return BrowserVersion.CHROME;
		else if(htmlUnitBrowserVersion.equals("INTERNET_EXPLORER_8"))
			return BrowserVersion.INTERNET_EXPLORER_8;
		else
			return BrowserVersion.getDefault();
	}
 
開發者ID:jhc-systems,項目名稱:redsniff,代碼行數:15,代碼來源:SeleniumTesterFactory.java

示例8: LinkedInOAuthRequestFilter

@SuppressWarnings("deprecation")
public LinkedInOAuthRequestFilter(OAuthParams oAuthParams, Map<String, Object> httpParams,
                                  boolean lazyAuth, String[] enabledProtocols) {

    this.oAuthParams = oAuthParams;
    this.oAuthToken = null;

    // create HtmlUnit client
    webClient = new WebClient(BrowserVersion.FIREFOX_38);
    final WebClientOptions options = webClient.getOptions();
    options.setRedirectEnabled(true);
    options.setJavaScriptEnabled(false);
    options.setThrowExceptionOnFailingStatusCode(true);
    options.setThrowExceptionOnScriptError(true);
    options.setPrintContentOnFailingStatusCode(LOG.isDebugEnabled());
    options.setSSLClientProtocols(enabledProtocols);

    // add HTTP proxy if set
    if (httpParams != null && httpParams.get(ConnRoutePNames.DEFAULT_PROXY) != null) {
        final HttpHost proxyHost = (HttpHost) httpParams.get(ConnRoutePNames.DEFAULT_PROXY);
        final Boolean socksProxy = (Boolean) httpParams.get("http.route.socks-proxy");
        final ProxyConfig proxyConfig = new ProxyConfig(proxyHost.getHostName(), proxyHost.getPort(),
            socksProxy != null ? socksProxy : false);
        options.setProxyConfig(proxyConfig);
    }

    // disable default gzip compression, as error pages are sent with no compression and htmlunit doesn't negotiate
    new WebConnectionWrapper(webClient) {
        @Override
        public WebResponse getResponse(WebRequest request) throws IOException {
            request.setAdditionalHeader(HttpHeaders.ACCEPT_ENCODING, "identity");
            return super.getResponse(request);
        }
    };

    if (!lazyAuth) {
        try {
            updateOAuthToken();
        } catch (IOException e) {
            throw new IllegalArgumentException(
                String.format("Error authorizing user %s: %s", oAuthParams.getUserName(), e.getMessage()), e);
        }
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:44,代碼來源:LinkedInOAuthRequestFilter.java

示例9: CSVTable

public CSVTable(File csvFile) {
    this.csvFile = csvFile;
    if(!csvFile.exists())
        throw new AssertionError(csvFile.getAbsolutePath() + " does not exist");
    csvTester = new RedsniffWebDriverTester(new HtmlUnitDriver(BrowserVersion.FIREFOX_38));
}
 
開發者ID:jhc-systems,項目名稱:redsniff,代碼行數:6,代碼來源:CSVTable.java


注:本文中的com.gargoylesoftware.htmlunit.BrowserVersion.FIREFOX_38屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。