FearghalQA
FearghalQA

Reputation: 265

Set up drivers for owasp zap in selenium using java

Hi I am trying to set up an automated framework using ZAP with my automated tests for a web application im tsting. But i cant seem to figure out how to start teh driver and open the website on chrome. Aparantly its quite easy and im trying to add

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);

to my code but cant seem to figure out how this class is meant to be added to the tests, should this be @BeforeTest and how could i add it to my tests? Any help appreciated, I havent done any security testing before and have no idea how to do it.

Tried this also

    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");

Upvotes: 0

Views: 926

Answers (1)

Simon Bennetts
Simon Bennetts

Reputation: 6186

proxy.setHttpProxy("localhols:8080")

Typo in the host name: should be "localhost" ?

Upvotes: 1

Related Questions