Why does setting includeInContext in the context affect browser authentication?

20 views
Skip to first unread message

guanggang long

unread,
Jan 20, 2026, 5:36:20 AM (3 days ago) Jan 20
to ZAP User Group
Hello!

zap version: 2.17.0

After setting includeInContext in the context, authentication failed during the browser authentication process. Strangely, after removing includeInContext from the context, authentication successfully completed. Can you provide some suggestions? Thank you.

public String createContext(Context contextApi, String contextName, String targetUrl) throws Exception {
        String contextId;
        try {
            ApiResponse contextResp = contextApi.newContext(contextName);
            contextId = ((ApiResponseElement) contextResp).getValue();
            //targetUrl is : http://192.168.11. 161/
            targetUrl = targetUrl + ".*";
            try {
                contextApi.includeInContext(contextName, targetUrl);
            } catch (Exception e) {
                log.error("error: {}", targetUrl);
            }
        } catch (Exception e) {
            contextId = "1";
        }
        return contextId;
    }


After adding includeInContext to the context, the error message during browser authentication:
org.openqa.selenium.WebDriverException: unknown error: net::ERR_PROXY_CONNECTION_FAILED
  (Session info: chrome=143.0.7499.192)
Build info: version: '4.39.0', revision: '126f156aee'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-84-generic', java.version: '17.0.17'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [44deb0ddac2ef70c7e2ece0ced370606, get {url=http://192.168.11.161/}]
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 143.0.7499.192, chrome: {chromedriverVersion: 143.0.7499.42 (24bdc8c48a0c..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:processID: 220, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(manual, http=localhos..., setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webSocketUrl: ws://localhost:15325/sessio..., webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}

Simon Bennetts

unread,
Jan 20, 2026, 7:26:42 AM (3 days ago) Jan 20
to ZAP User Group
Hi,

I'm afraid we do not have neough information here to understand what you are doing or what is going on.
Also, do have a look at the Automation Framework - that is more suitable than using the ZAP API for most users.

Cheers,

Simon
Reply all
Reply to author
Forward
0 new messages