This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
1 / 13
Sep 2014

Has anyone tried using browser mob proxy with iOS Safari?
Below is my code , but it doesn't generate any HAR File. So I doubt if traffic is being routed through proxy.

If I manuall set the browserMob proxy on device, it works

   //Create new proxy server
    mobProxyServer = new ProxyServer(9901);
    mobProxyServer.start();

    //Create Selenium Proxy Object
    Proxy proxy = mobProxyServer.seleniumProxy();


    //Set Capabilities
    DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
    desiredCapabilities.setCapability(CapabilityType.PROXY,proxy);
    desiredCapabilities.setCapability("platformName", "iOS");
    desiredCapabilities.setCapability("platform-version", "7.0");
    desiredCapabilities.setCapability("browserName","safari");
    desiredCapabilities.setCapability("deviceName","iPhone 5s");

    //Create Driver
    //AppiumDriver driver = new AppiumDriver(new URL("http://0.0.0.0:4723/wd/hub"),desiredCapabilities);
     driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"),desiredCapabilities);


    //Create HAR File
    mobProxyServer.newHar("test");

    //Open website
    driver.get("http://m.att.com");
    Thread.sleep(10000);

    //get and save HAR
    Har har = mobProxyServer.getHar();
    FileOutputStream fHarFile = new FileOutputStream("test.har");
    har.writeTo(fHarFile);
  • created

    Sep '14
  • last reply

    Apr '17
  • 12

    replies

  • 4.5k

    views

  • 9

    users

  • 1

    like

  • 1

    link

4 months later

I do automation using iOS Simulators on VMs. (VMWare Fusion) You need to set the OS X System Proxy in order for the emulator to use a proxy.

If you're using a physical device, I'm not sure I can help.

When setting the system proxy, make sure to add the IP of your Selenium Grid and of the host running BMProxy to the proxy bypass settings, or Appium will try to connect to the grid via the proxy.

We haven't looked into it in a while, but we have to use a set of static proxy port mappings (instead of on-the-fly) because the proxy Capability doesn't seem to work in the scenario we use.

Granted, the initial research and implementation was done about a year ago using Appium 1.0, so if this has changed, that would be awesome.

I am able to get the HAR entries for Firefox but no luck with simulator or device(getting HAR with no entries in the file).
Is there anyway to setup browsermob proxy on my device ? Please help.

Thanks,
Amarnath

3 months later

I was able to do it with both Android Emulators/Real device and also with iOS simulators/real device. We did it with Appium 1.0. I will try again doing this with latest Appium version 1.3.7 and share my findings soon.

23 days later

Hi Amit,

Were you able to test browsermob proxy with iOS real device and simulators?

Thanks
Gulshan

2 months later

Hi Gulshan,

I am trying to accomplish the same but i am also getting empty HAR file. Were you able to find the resolve to this problem.

Regards,
-
JK

20 days later
1 month later
1 year later
5 months later

Hi Amarnath,

What settings do i need to change in device for browsermob proxy to work on a real device. I am using Appium 1.5.3 and trying to run my tests on iPhone 10.x version.

Below is my code.

    BrowserMobProxy proxy = new BrowserMobProxyServer();
	proxy.start();		
	Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
	capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);

Any help would be appreciated.

Thanks,
Manoj

1 month later