I am trying to add an extension to my chromedriver for use in my test.
According to the nightwatchjs website here,
extensions | array of strings | A list of Chrome extensions to install on startup. Each item in the list should be a base-64 encoded packed Chrome extension (.crx)
I used another chrome extension to pull down the encoded .crx file from the chrome store and have it in my project.
Here is the relevant part of my conf.js
file:
test_settings: {
default: {
launch_url: launch_url,
screenshots : {
enabled : true,
on_failure: true,
on_error: true,
path : "./nw_out"
},
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
chromeOptions : {
extensions: ['./extension_1_5.crx'] //this is the line that is erroring
}
}
}
}
Here is my test file (I understand it's not the most clean at the moment, but will work that out once I get this problem resolved).
module.exports = {
'Trello Card Data' : function (browser) {
browser
.windowMaximize()
.url('https://trello.com/')
.pause(3000)
.useCss()
.click('#content > div > p > a')
.useXpath()
.setValue('//*[@id="user"]', '<email>')
.setValue('//*[@id="password"]', '<password>')
.useCss()
.click('#login')
.pause(5000)
.end();
}
};
When I run this test (configuration is working when I remove the chromeOptions from the desiredCapabilities
), I am getting the following error:
Error retrieving a new session from the selenium server Connection refused! Is selenium server started? { state: 'unhandled error',
sessionId: null, hCode: 3329947, value: { additionalInformation: '\nDriver info: org.openqa.selenium.chrome.ChromeDriver', localizedMessage: 'unknown error: cannot process extension #1\nfrom unknown error: cannot base64 decode\n (Driver info: chromedriver=2.20.353145, platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 655 milliseconds\nBuild info: version: \'2.53.0\', revision: \'35ae25b\', time: \'2016-03-15 17:00:58\'\nSystem info: host: \'\', ip: \'\', os.name: \'Windows 7\', os.arch: \'x86\', os.version: \'6.1\', java.version: \'1.8.0_101\'\nDriver info: org.openqa.selenium.chrome.ChromeDriver', systemInformation: 'System info: host: \'\', ip: \'\', os.name: \'Windows 7\', os.arch: \'x86\', os.version: \'6.1\', java.version: \'1.8.0_101\'', supportUrl: null, cause: null, suppressed: [], message: 'unknown error: cannot process extension #1\nfrom unknown error: cannot base64 decode\n (Driver info: chromedriver=2.20.353145, platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 655 milliseconds\nBuild info: version: \'2.53.0\', revision: \'35ae25b\', time: \'2016-03-15 17:00:58\'\nSystem info: host: \'\', ip: \'\', os.name: \'Windows 7\', os.arch: \'x86\', os.version: \'6.1\', java.version: \'1.8.0_101\'\nDriver info: org.openqa.selenium.chrome.ChromeDriver', hCode: 19834450, class: 'org.openqa.selenium.WebDriverException', buildInformation: { buildRevision: '35ae25b', buildTime: '2016-03-15 17:00:58', releaseLabel: '2.53.0', hCode: 10545182, class: 'org.openqa.selenium.internal.BuildInfo' }, screen: null }, class: 'org.openqa.selenium.remote.Response', status: 13 }
Any help in determining the solution to this would be greatly appreciated.