ChromeDriver - running with a specific extension loaded.

160 views
Skip to first unread message

Rogan Creswick

unread,
Mar 7, 2012, 6:04:24 PM3/7/12
to seleniu...@googlegroups.com
I need to run a series of tests for a chrome extension; however, every
incantation of ChromeOptions that I've tried has resulted in the
base64 decoding exception shown below (full stack trace is at the
bottom of this message):

{{{
org.openqa.selenium.WebDriverException: Error occurred while
processing capability 'extensions';
Error occurred while parsing extension: Could not decode base64 data
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 661 milliseconds
Build info: version: '2.20.0', revision: '16008', time: '2012-02-28 15:00:40'
System info: os.name: 'Linux', os.arch: 'amd64', os.version:
'3.2.6-3.fc16.x86_64', java.version: '1.7.0_02'
}}}

Does anyone have advice for (1) getting around this problem, and
testing chrome extensions with selenium, or (2) debugging the problem?
I'm not familiar with the Selenium source, but I'm not afraid of
diving in, if necessary.

We're using the latest chromedriver
(chromedriver_linux64_18.0.1022.0.zip, although it also happens with
933, and the 32-bit versions). I'm using chrome ver. 17.0.963.56.

The current code for setting options is:

{{{

public static ChromeDriver buildChromeDriver() {
// set the chrome driver path based on OS & Arch:
String chromeDriverPth = mkPath(CD_BASE_PATH, osNameArch(), CD_BINARY_NAME);
System.setProperty("webdriver.chrome.driver", chromeDriverPth);

ChromeOptions options = new ChromeOptions();
options.addArguments("--user-data-dir=../profiles/chrome");
options.addExtensions(new File("../contexts/fiveui.crx"));

return new ChromeDriver(options);
}

}}}

Chrome will properly load the crx file referenced above, so the file
itself seems fine.

(as an aside: the extension has also been ported to FireFox, and
incedentially, and advice on testing firefox extensions with Selenium
would /also/ be greatly appreciated).

Thanks!
Rogan

Exception:

org.openqa.selenium.WebDriverException: Error occurred while
processing capability 'extensions';
Error occurred while parsing extension: Could not decode base64 data
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 661 milliseconds
Build info: version: '2.20.0', revision: '16008', time: '2012-02-28 15:00:40'
System info: os.name: 'Linux', os.arch: 'amd64', os.version:
'3.2.6-3.fc16.x86_64', java.version: '1.7.0_02'
Driver info: driver.version: ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:170)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:123)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:438)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:139)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:94)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:144)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:120)
at com.galois.fiveui.testrunner.Drivers.buildChromeDriver(Drivers.java:53)
at com.galois.fiveui.chrome.ChromeExtensionRunsTest.setUp(ChromeExtensionRunsTest.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Rogan Creswick

unread,
Mar 7, 2012, 6:12:32 PM3/7/12
to seleniu...@googlegroups.com
I just found the chromedriver.log, which strikes me as a bit odd:

[0.000][INFO]: ChromeDriver 18.0.1022.0
/home/creswick/development/uic/tools/seleniumChromeDrivers/lin64/chromedriver
[0.616][FINE]: Initializing session with capabilities {
"browserName": "chrome",
"chrome.switches": [ "--user-data-dir=../profiles/chrome" ],
"chromeOptions": {
"args": [ "--user-data-dir=../profiles/chrome" ],
"extensions": [ "ewogICAgIm5hbWUiOiAiRml2ZSBVSSIsCiAgI..." ]
},
"platform": "ANY",
"version": ""
}

The ... in the "extensions" field string is literal (I didn't shorten
the string for brevity).

I don't know how to fix that, but it looks suspicious to me.

--Rogan

Bradley Stillwagon

unread,
Aug 31, 2016, 2:28:17 AM8/31/16
to Selenium Users, cres...@gmail.com
Were you ever able to figure out what went wrong?  I'm getting that exact error now and I'm having trouble tracking down a solution.
Reply all
Reply to author
Forward
0 new messages