This repository has been archived by the owner on Sep 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Configure Tests to proxy via OWASP ZAP
dannyprok edited this page Jul 9, 2018
·
1 revision
Within your WebDriver project you will need to configure the driver to proxy all requests via the ZAP Proxy.
For FirefoxDriver:
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.firefox.FirefoxOptions
import org.openqa.selenium.firefox.FirefoxProfile
...
val options: FirefoxOptions = new FirefoxOptions
options.addPreference("network.proxy.type", 1)
options.addPreference("network.proxy.http", "localhost")
options.addPreference("network.proxy.http_port", 11000)
options.addPreference("network.proxy.share_proxy_settings", true)
options.addPreference("network.proxy.no_proxies_on", "")
var driver = new FirefoxDriver(options)
For ChromeDriver:
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
...
var options = new ChromeOptions()
options.addArguments("test-type")
options.addArguments("--proxy-server=http://localhost:11000")
var driver = new ChromeDriver(options)
Similar to how you'd configure WebDriver within your test suite, you will need to configure your HTTP Client of choice to proxy requests via ZAP. For example, you'd configure RestAssured.io like this:
import io.restassured.RestAssured
...
RestAssured.proxy("localhost", PROXY_PORT);