0

So I was planning on writing an automated test using python-selenium(really webdriver) that uses a subprocess to throttle the connection speed before a suite of tests. I found this great script for ipfw, only to find out that OS X El Capitan switched to PF(Packet Filter) at Yosemite.

Everything I keep running into is obsolete. So what's the best way to throttle internet via shell or cli on El Capitan? Does anyone have a script they can share? Network Link Conditioner is great for testing but it would be great if I could start catching bugs that occur at slow speeds with automation.

Community
  • 1
  • 1
Cynic
  • 6,779
  • 2
  • 30
  • 49
  • Can't do it from the command line since webdriver uses up your one available `--debug` sessions, but available in Chrome's devtools as Network Connectivity Emulation. Or install NLC in a VM/container and use that. – meatspace Jun 22 '16 at 18:30
  • I was looking into why a debug flag would be an issue and came across this: http://stackoverflow.com/questions/27881485/network-throttling-with-chrome-and-selenium, which is only an issue if I'm using dev tools to slow the connection which isn't what I was asking how to do. I was talking about slowing all traffic at a system level. Don't think VM answers the question. Did come across a newer script http://serverfault.com/questions/725030/traffic-shaping-on-osx-10-10-with-pfctl-and-dnctl but haven't been able to get it working on OSX 10.11.5 – Cynic Jun 28 '16 at 01:05

1 Answers1

1

I was able to throttle network using network link conditioner. To install network link conditioner, you need to get Hardware IO Tools. More details are available in Installing Apple's Network Link Conditioner Tool

To automate the setting of bandwidth profile in network link conditioner, you can refer my answer in https://stackoverflow.com/questions/34876073/switch-network-link-conditioner-profiles-from-console-script

Community
  • 1
  • 1
Balaji Dubey
  • 446
  • 5
  • 10
  • Accepted the answer because this works. But it is a bit annoying to have to use an applescript to use the GUI for NLC. If anyone finds a way to do this without using the GUI to turn on NLC profiles or throttle using Packet Filter please let us know. – Cynic Aug 19 '16 at 18:28