title: How do I bypass the "Flash Camera and Microphone Access" pop-up when using Pepper/PPAPI Flash in Chrome (via Selenium)?
body: <p>Chrome supports two flavors of Flash:  NPAPI and PPAPI (Pepper).  These two implementations seem to handle camera and microphone permissions differently.  Specifically, PPAPI (Pepper) does not appear to honor any previous grants of permission.</p>
  
  <p>With NPAPI, which is the default, the first time I navigate to a Flash site that requests permission to use the computer's camera and microphone, an Adobe Flash pop-up asks the user to allow or deny access.  I allow access, and this grant is remembered.  The next time I navigate to that site, permission is granted automatically, without the pop-up.</p>
  
  <p>When I want to test with PPAPI (Pepper) Flash, I specify the "--enable-bundled-ppapi-flash" and "--disable-npapi" command-line arguments to Chrome.  In this mode, the previous grants are ignored, and the pop-up is displayed every time.  I have not figured out how to detect this in Selenium and click on "Allow".</p>
  
  <p>Does anyone know how to bypass this pop-up, either by clicking on "Allow", or by disabling it altogether?</p>
  
  <p>Thanks.</p>
  
  <p><strong>Update:</strong>  I have discovered that non-Pepper Flash stores camera/microphone permissions in a file called 'settings.sol', stored in a directory specific to the site requesting access.  For example, on Windows, when the host at 1.2.3.4 requests access, the following file is created:</p>
  
  <p>C:\Users[user]\AppData\Roaming\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys#1.2.3.4\settings.sol</p>
  
  <p>Note the space in "Flash Player".  This file is a local shared object, encoded as AMF.  I use the Python pyamf package to create a file that grants permanent access to a site:</p>
  
  <pre><code>from pyamf import sol
  
  permissions = sol.SOL ('1.2.3.4/settings')
  permissions[u'always'] = True
  permissions[u'allow'] = True
  permissions[u'klimit'] = 100
  sol.save (permissions, 'my-settings.sol')
  </code></pre>
  
  <p>When I copy this to the appropriate directory, access is granted automatically.  But again, this does not work for Pepper Flash.</p>
  
  <p>Pepper Flash ignores this directory, and instead gets a new temporary directory for each instance of Chrome:</p>
  
  <p>C:\Users[user]\AppData\Local\Temp\scoped_dir5976_6686\Default\Pepper Data\Shockwave Flash\WritableRoot#SharedObje
  cts\6DMDJWLP\macromedia.com\support\flashplayer\sys#1.2.3.4\settings.sol</p>
  
  <p>Unfortunately, the directory changes on each invocation.  If I could somehow discover the name of this directory, then I could upload the file before requesting access.</p>
  
  <p>But I don't know how to discover the name of this directory.</p>