How to bypass the Flash and Microphone Access popup when using Pepper / PPAPI Flash in Chrome (via Selenium)?

Chrome supports two flavors of Flash: NPAPI and PPAPI (Pepper). These two implementations seem to handle camera and microphone resolutions differently. In particular, PPAPI (Pepper) doesn't seem to honor any of the previous permissions.

When using NPAPI, which is the default the first time a Flash site is accessed and asks for permission to use a computer camera and microphone, an Adobe Flash pop-up window asks the user to grant or deny access. I grant access and this grant is remembered. The next time I go to this site, the permission will be granted automatically, no popup.

When I want to test with PPAPI (Pepper) Flash, I specify the command line arguments "--enable-bundled-ppapi-flash" and "--disable-npapi" for Chrome. In this mode, previous grants are ignored and a popup is displayed every time. I didn't understand how to detect this in Selenium and click "Allow".

Does anyone know how to bypass this popup by either clicking Allow or disabling it entirely?

Thank.

Update: . I found that non-Pepper Flash stores the camera / microphone permissions in a file called "settings.sol" stored in a directory specific to the site requesting access. For example, on Windows, when a host in 1.2.3.4 requests access, the following file is created:

C: \ Users [user] \ AppData \ Roaming \ Macromedia \ Flash Player \ macromedia.com \ support \ flashplayer \ sys # 1.2.3.4 \ settings.sol

Notice the gap in "Flash Player". This file is a local shared object encoded as AMF. I am using the python package pyamf to create a file that provides persistent access to the site:

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')

      

When I copy it to the appropriate directory, access is automatically granted. But again, this doesn't work for Pepper Flash.

Pepper Flash ignores this directory and instead gets a new temporary directory for each Chrome instance:

C: \ Users [user] \ AppData \ Local \ Temp \ scoped_dir5976_6686 \ Default \ Pepper Data \ Shockwave Flash \ WritableRoot # SharedObje karats \ 6DMDJWLP \ macromedia.com \ support \ Flashplayer \ Sys # 1.2.3.4 \ settings.sol

Unfortunately, the directory changes on every call. If I could somehow find out the name of this directory, I could download the file before requesting access.

But I don't know how to find out the name of this directory.

+3


source to share


2 answers


It turns out my problem was specific to Selenium and how I was using Selenium.

First, back to NPAPI Flash, which stores its Windows permissions in a subdirectory under the user's directory; eg:

C:\Users[user]\AppData\Roaming\Macromedia\Flash  Player\macromedia.com\support\flashplayer\sys

      

Pepper Flash does not use this directory for its permissions, and thus does not implement the settings stored there. Instead, it stores its permission files in a subdirectory under the Chrome user data directory.

When I instantiated the Chrome browser via Selenium, a temporary user data directory was created for the session. For example:



C:\Users[user]\AppData\Local\Temp\scoped_dir5976_6686

      

Pepper Flash kept its permission files under this directory, but when the browser session ended, this temporary directory was deleted and the settings were forgotten.

The solution is simple: when launching Chrome through Selenium, specify the Chrome user data directory using the command line argument:

"user-data-dir=C:\\Users\\[user]\AppData\Local\Google\Chrome\User Data"

      

Pepper Flash will store its permissions in this directory, and since it is a permanent directory that is not deleted when the browser session ends, it will be available to the next instance and thus the permissions granted will be preserved.

+1


source


On linux, the directory seems to be application specific. Chrome browser seems to store them in

~/.config/chromium/Default/Pepper Data

      

Qt WebEngine programs seem to save them in



~/.local/share/[NAMEOFTHEAPPLICATION]/QtWebEngine/Default/Pepper Data

      

I needed to delete the directory to remove the permanent webcam permission (which I gave the site for testing).

0


source







All Articles