# Setting up BrowserMob proxy to work with iOS Safari

**URL:** <https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341>\
**Category:** Support\
**Created:** [September 12, 2014, 1:29pm UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341 "2014-09-12T13:29:43Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aniket\_Gadre](https://discuss.appium.io/user_avatar/discuss.appium.io/aniket_gadre/32/5301_2.png) [@Aniket\_Gadre](https://discuss.appium.io/u/Aniket_Gadre)\
**Post date:** [September 12, 2014, 1:29pm UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341/1 "2014-09-12T13:29:43Z")

</div>

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);
```

---

<div class="post-metadata">

**Author:** ![AmarnathRayudu](https://discuss.appium.io/user_avatar/discuss.appium.io/amarnathrayudu/32/3340_2.png) [@AmarnathRayudu](https://discuss.appium.io/u/AmarnathRayudu)\
**Post date:** [January 29, 2015, 6:39pm UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341/2 "2015-01-29T18:39:11Z")

</div>

Hi Aniket,

I am looking for the same … any luck on this ?  
-Amarnath Rayudu

---

<div class="post-metadata">

**Author:** ![Hysistia](https://discuss.appium.io/letter_avatar_proxy/v4/letter/h/96bed5/32.png) [@Hysistia](https://discuss.appium.io/u/Hysistia)\
**Post date:** [January 29, 2015, 8:00pm UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341/3 "2015-01-29T20:00:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Hysistia](https://discuss.appium.io/letter_avatar_proxy/v4/letter/h/96bed5/32.png) [@Hysistia](https://discuss.appium.io/u/Hysistia)\
**Post date:** [January 29, 2015, 8:02pm UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341/4 "2015-01-29T20:02:46Z")

</div>

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.

![](https://discuss.appium.io/uploads/default/604/8c04b0b0728eed52.png)

---

<div class="post-metadata">

**Author:** ![AmarnathRayudu](https://discuss.appium.io/user_avatar/discuss.appium.io/amarnathrayudu/32/3340_2.png) [@AmarnathRayudu](https://discuss.appium.io/u/AmarnathRayudu)\
**Post date:** [February 4, 2015, 7:45pm UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341/5 "2015-02-04T19:45:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sahajamit](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@sahajamit](https://discuss.appium.io/u/sahajamit)\
**Post date:** [May 6, 2015, 4:46am UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341/6 "2015-05-06T04:46:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gsaini3](https://discuss.appium.io/user_avatar/discuss.appium.io/gsaini3/32/952_2.png) [@gsaini3](https://discuss.appium.io/u/gsaini3)\
**Post date:** [May 29, 2015, 7:55am UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341/7 "2015-05-29T07:55:57Z")

</div>

> [@sahajamit](#):
>
> 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.

Hi Amit,

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

Thanks  
Gulshan

---

<div class="post-metadata">

**Author:** ![jk](https://discuss.appium.io/letter_avatar_proxy/v4/letter/j/bcef8e/32.png) [@jk](https://discuss.appium.io/u/jk)\
**Post date:** [July 29, 2015, 7:08pm UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341/8 "2015-07-29T19:08:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AmarnathRayudu](https://discuss.appium.io/user_avatar/discuss.appium.io/amarnathrayudu/32/3340_2.png) [@AmarnathRayudu](https://discuss.appium.io/u/AmarnathRayudu)\
**Post date:** [August 19, 2015, 5:25am UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341/9 "2015-08-19T05:25:54Z")

</div>

Hi Folks …

It works on real device, need to change the proxy settings in the device.

Thanks,  
Amarnath

---

<div class="post-metadata">

**Author:** ![sahajamit](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@sahajamit](https://discuss.appium.io/u/sahajamit)\
**Post date:** [September 20, 2015, 3:36pm UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341/10 "2015-09-20T15:36:17Z")

</div>

I am able to finally make it work on simulator as well. Please see this.

> <https://stackoverflow.com/questions/26058211/ios-8-xcode-6-simulator-is-not-using-http-proxy-anymore>

---

<div class="post-metadata">

**Author:** ![jayant](https://discuss.appium.io/letter_avatar_proxy/v4/letter/j/ecb155/32.png) [@jayant](https://discuss.appium.io/u/jayant)\
**Post date:** [September 30, 2016, 3:55pm UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341/11 "2016-09-30T15:55:42Z")

</div>

Hi Amit,

I referred : [http://stackoverflow.com/questions/26058211/ios-8-xcode-6-simulator-is-not-using-http-proxy-anymore](http://stackoverflow.com/questions/26058211/ios-8-xcode-6-simulator-is-not-using-http-proxy-anymore)

but they just suggest to restart the simulator which did not work for me… can you suggest what exactly you did to make your simulator to use proxy?

---

<div class="post-metadata">

**Author:** ![manoj\_ks](https://discuss.appium.io/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@manoj\_ks](https://discuss.appium.io/u/manoj_ks)\
**Post date:** [March 9, 2017, 5:29am UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341/12 "2017-03-09T05:29:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Suresh\_Marimuthu](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@Suresh\_Marimuthu](https://discuss.appium.io/u/Suresh_Marimuthu)\
**Post date:** [April 21, 2017, 2:43pm UTC](https://discuss.appium.io/t/setting-up-browsermob-proxy-to-work-with-ios-safari/341/13 "2017-04-21T14:43:40Z")

</div>

Hi Amarnath,

What proxy setting need to do in device. Can you elaborate.?
