0

I am writing automation test for mobileweb and mobileapp.

For mobileweb, I am using browsermob proxy to capture the networks responses from the browser.

https://github.com/lightbody/browsermob-proxy

Mobileweb code:-

I want to start the proxy for the firefox driver and run the tests.

Tests working in my local environment.

How can i setup proxy on saucelabs?

My code:-

ProxyServer proxyServer = new ProxyServer(4444);
proxyServer.start();    

Proxy proxy = proxyServer.seleniumProxy();
DesiredCapabilities capabillities = DesiredCapabilities.firefox();
capabillities.setCapability(CapabilityType.PROXY, proxy);
capabillities.setCapability("version", "5");
capabillities.setCapability("platform", Platform.XP);
this.driver = new RemoteWebDriver(
        new URL("http://myname:xxxxxx@ondemand.saucelabs.com:80/wd/hub"),
        capabillities);

Is it possible to use the same proxy code to capture the networks responses for the mobile app.

Galet
  • 4,039
  • 12
  • 62
  • 119

2 Answers2

0

You can try Charles Proxy on your PC, to see all HTTP traffic (including apps) from your device. Here are instructions to configure it.

Community
  • 1
  • 1
webo80
  • 3,210
  • 5
  • 29
  • 47
0

Yes you can achieve this using light body browsermob proxy. Kindly follow the steps in the github link https://github.com/lightbody/browsermob-proxy.

Need to install browsermob proxy certificate in the device and also set the proxy in the mobile device.

BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.start(8888);

Steps to setup the manual proxy in the device:

  1. Go to device settings
  2. Tap wifi connection
  3. Long press on the connected network
  4. Tap Manage network config
  5. Tap Show advanced options
  6. Change proxy to manual
  7. Set the ip address of the computer (Device network and computer network should be the same)
  8. Set the port that is using in the code in our case it is 8888
alk1985
  • 43
  • 2
  • 12