本文整理汇总了Java中com.meterware.httpunit.HttpUnitOptions.setScriptingEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java HttpUnitOptions.setScriptingEnabled方法的具体用法?Java HttpUnitOptions.setScriptingEnabled怎么用?Java HttpUnitOptions.setScriptingEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.meterware.httpunit.HttpUnitOptions
的用法示例。
在下文中一共展示了HttpUnitOptions.setScriptingEnabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBrowseCatalog
import com.meterware.httpunit.HttpUnitOptions; //导入方法依赖的package包/类
public void testBrowseCatalog() throws Exception {
try {
// Disable scripting support until HttpUnit has better support for AJAX, Dojo...
HttpUnitOptions.setScriptingEnabled(false);
HttpUnitOptions.setExceptionsThrownOnScriptError(false);
// Start with the home page
WebConversation wc = new WebConversation();
WebRequest req = new GetMethodWebRequest("http://" + serverHost + ":" + serverPort + "/" + context);
WebResponse resp = wc.getResponse(req);
testMainPage(wc, resp);
testSellerPage(wc, resp);
testSearchPage(wc, resp);
testCatalogPage(wc, resp);
testMapPage(wc, resp);
testTagsPage(wc, resp);
} catch (ConnectException e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
fail("Could not connect to the server. Received Exception: \n" + sw.toString());
}
}
示例2: getAccesToken
import com.meterware.httpunit.HttpUnitOptions; //导入方法依赖的package包/类
private String getAccesToken(
final String applicationKey,
final String username,
final String password) throws IOException {
try {
HttpUnitOptions.setScriptingEnabled(false);
WebConversation wc = new WebConversation();
WebResponse resp = wc.getResponse(String.format(OAUTH_GET_ACCESS_TOKEN_URL, applicationKey));
WebForm form = findLoginForm(resp.getForms());
form.setParameter("login", username);
form.setParameter("password", password);
resp = form.submit();
if(!resp.getURL().toString().contains("code=")) {
resp = resp.getLinkWith("Allow").click();
}
return resp.getURL().toString().split("code=")[1];
} catch (SAXException ex) {
throw new IOException(ex);
}
}
示例3: setScriptingEnabled
import com.meterware.httpunit.HttpUnitOptions; //导入方法依赖的package包/类
/**
* Method setScriptingEnabled.
* @param scriptingEnabled
*/
public void setScriptingEnabled(String scriptingEnabled) {
boolean enabled = (scriptingEnabled.equalsIgnoreCase("true")) ? true : false;
HttpUnitOptions.setScriptingEnabled(enabled);
verbose("ScriptingEnabled: " + HttpUnitOptions.isScriptingEnabled());
}