ericmckean / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

Enabled PNaCl Components in ChromeDriver - Enhancement #886

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
As part of the Chrome project I am automating I have come across the need to 
have PNaCl working with the Chromedriver instantiation of Chrome.

In the current Chromedriver version the component PNaCl translator is disabled 
and no path is given under chrome://nacl and none of the normal components I 
have on Chrome are loaded. This is causing my web application to fail to load 
as it is dependent on NaCl.

What steps will reproduce the problem?
1. Have an Chrome Web Application that relies on NaCl upon startup
2. Launch Chrome using ChromeDriver 
3. Open the browser inspector and navigate to the console
4. A line like this will appear: "NativeClient: The Portable Native Client 
(pnacl) component is not installed. Please consult chrome://components for more 
information." 

Optimally I would like to see the PNaCl components translator linked when 
launching with the ChromeDriver as it is unlinked under chrome://nacl when 
using the ChromeDriver instantiation on Chrome. 

Selenium version: 2.42.2
OS: OS X 10.9.4
Browser: Chrome
Browser version: 36.0.1985.143

If you need anymore information from me or anything else on my end that would 
help please let me know.

Thanks,
Tanner

Original issue reported on code.google.com by t...@vernier.com on 19 Aug 2014 at 10:47

GoogleCodeExporter commented 9 years ago
Update:

Along with the NaCl page not having a linked translator the PNaCl and NaCl 
components do not exist under chrome://components. 
And as expected (considering the components do not exist) the 'NaCl for web 
applications' is Disabled by default under chrome://flags.

There is no workaround for this judging from all the research I have done. 
Unfortunately because of how the chromedriver launches the "automation 
instance" of Chrome it is not possible to fix this without a modified 
chromedriver.

This blocks any Web or Chrome App that uses NaCl or PNaCl in tandem with 
chromedriver for automation purposes. 

Original comment by t...@vernier.com on 4 Sep 2014 at 9:55

GoogleCodeExporter commented 9 years ago
Adding NaCl folks, we're not familiar with WebDriver's implementation but we 
may be able to help nonetheless.

Original comment by j...@chromium.org on 14 Sep 2014 at 11:19

GoogleCodeExporter commented 9 years ago
It looks like chromedriver by default runs with "--disable-component-update", 
which PNaCl normally relies upon to get installed/updated:
https://chromium.googlesource.com/experimental/chromium/src/+/c457dcf77264057729
d025b3f85921c669fc0e20/chrome/test/chromedriver/chrome_launcher.cc#111

Unfortunately, component updater is responsible for both installing and 
"registering"/discovering the PNaCl files.

So, even if you already had PNaCl installed and you see it when you launch 
chrome normally outside of chromedriver, having --disable-component-update 
prevents the installed copy from being discovered.  However, perhaps 
"--disable-component-update" was added because chromedriver uses fresh 
user-data-dirs each run. Component updater would normally install the files to 
the user-data-dir, so if it's chromedriver makes a fresh directory each test 
run, it would need to re-download a bunch of files fpor every test run, and 
that would be bad.

Perhaps what we could do is add a chrome flag (let's say, --pnacl-dir) to tell 
chrome where to find the installed PNaCl files (independent of user-data-dir). 
Then you could script chromedriver:

ChromeOptions options = new ChromeOptions();
options.addArguments("pnacl-dir=<some known translator path listed under 
chrome:nacl normally>")
...

Original comment by jvoung@chromium.org on 17 Sep 2014 at 1:05

GoogleCodeExporter commented 9 years ago
We hit this problem with trying to get DRMed video playback going using HTML5 
player (HTML5MediaElement). We are using WidevineCDM in our DRM stack, which 
requires NaCl support. 

To work around this issue, use the Chrome-specific desired capability called 
'excludeSwitches' and build the driver as follows (e.g. for node.js):

var webdriver = require('selenium-webdriver');
var chrome = require("selenium-webdriver/chrome");
var capabilities = new webdriver.Capabilities.chrome();

var chromeOptions = {
     'args': ['--user-data-dir=C:/ChromeProfile'], // start with pre-configured Chrome profile
     'excludeSwitches': ['disable-component-update'] // stop breaking Native Client support
};

capabilities.set('chromeOptions', chromeOptions);

var driver = new webdriver.Builder().
    withCapabilities(capabilities).
    build();

driver.get('http://...');
...

Hope this helps.

-- ab1

Original comment by Anton.Be...@gmail.com on 5 Nov 2014 at 6:55

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:18