您好,我正在尝试使用 ZAP 和我的 Web 应用程序的自动化测试来建立一个自动化框架。但我似乎无法弄清楚如何启动驱动程序并在 chrome 上打开网站。显然它很容易,我正在尝试添加
Proxy proxy = new Proxy();
proxy.setAutodetect(false);
proxy.setProxyType(ProxyType.MANUAL);
proxy.setHttpProxy("localhost:8080")
DesiredCapabilites.setCapability(CapabilityType,PROXY.proxy);
driver = new RemoteWebDriver(service.getUrl(), capabilties);
到我的代码,但似乎无法弄清楚如何将这个类添加到测试中,这应该是@BeforeTest 以及如何将它添加到我的测试中?感谢任何帮助,我之前没有做过任何安全测试,也不知道如何做。
也尝试过这个
DesiredCapabilities dc;
dc = DesiredCapabilities.firefox();
System.setProperty("http.proxyHost", "127.0.0.1");
System.setProperty("http.proxyPort", "8080");
System.setProperty("https.proxyHost", "127.0.0.1");
System.setProperty("https.proxyPort", "8080");
FirefoxOptions options = new FirefoxOptions();
options.addArguments("start-maximized");
options.addArguments("--disable-extensions");
dc.setCapability(FirefoxOptions.CAPABILTIES, options);
FirefoxDriver driver = new FirefoxDriver(dc);
driver.get("web-game-stage.sportdec.com");
最佳答案
proxy.setHttpProxy("localhols:8080")
主机名中的拼写错误:应该是“localhost”?
关于java - 使用 java 在 selenium 中设置 owasp zap 驱动程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54805455/