01: /*
02: * Created on 18.11.2005
03: * Author Sergey Pariev, spariev@gmail.com
04: */
05: package org.jzonic.webtester.commands;
06:
07: import org.jzonic.webtester.WebTestContext;
08:
09: /**
10: * This command allows to enable/disable JavaScript support in HttpUnit (enabled by default).
11: * <br/>
12: * examples:
13: * <br/>
14: * enable_javascript | true
15: * <br/>
16: * enable_javascript | false
17: *
18: * @author Sergey Pariev (spariev@gmail.com)
19: *
20: */
21: public class EnableJavaScriptCommand implements WebTestNode {
22:
23: public static final String COMMAND_NAME = "enable_javascript";
24: private String enableJS;
25:
26: public void setParameter(String value) {
27: enableJS = value;
28: }
29:
30: public WebTestNodeResult execute(WebTestContext context) {
31: WebTestNodeResult result = new WebTestNodeResult(COMMAND_NAME,
32: enableJS);
33:
34: context.enableJavaScript(Boolean.parseBoolean(enableJS));
35: result.setSuccess(true);
36: return result;
37: }
38:
39: public String getName() {
40: return COMMAND_NAME;
41: }
42:
43: }
|