Search code examples
javaappiumbrowsermob-proxy

how to capture network for native app with appium and browsermob proxy


I need help, i connected browsermob proxy with appium on my android device, i see all network calls, but on all HHTPS got error can not connect host.

here my browsermob proxy setup:

proxy = new BrowserMobProxyServer();
proxy.setTrustAllServers(true);
proxy.start(proxyPort);

here my appium setup:

    browserMobProxy.getProxy().setHarCaptureTypes(CaptureType.getResponseCaptureTypes());
browserMobProxy.getProxy().setHarCaptureTypes(CaptureType.getHeaderCaptureTypes());
browserMobProxy.getProxy().setHarCaptureTypes(CaptureType.getRequestCaptureTypes());
browserMobProxy.getProxy().setHarCaptureTypes(CaptureType.getCookieCaptureTypes());
browserMobProxy.getProxy().setHarCaptureTypes(CaptureType.getBinaryContentCaptureTypes());
browserMobProxy.getProxy().setHarCaptureTypes(CaptureType.getAllContentCaptureTypes());
browserMobProxy.getProxy().newHar(browserMobProxy.getHarRef());
capabilities.setCapability(CapabilityType.PROXY, browserMobProxy.getSeleniumProxy());
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability("unlockType", "pin");
capabilities.setCapability("unlockKey", "1111");

URL serverAddress = new URL("http://127.0.0.1:" + port + "/wd/hub");

androidDriver = new AndroidDriver(serverAddress, capabilities);

I installed on device the certificate, and setup manual proxy with IP:PORT

What I miss to get all https requests and responses ? Thanks


Solution

  • all worked as I wrote, I just installed ca-certificate-rsa.cer instead of ca-certificate-ec.cer on my device