Skip to content

Commit 7b9f505

Browse files
committed
fix(protractor.wrapDriver): allow browser instances to work even if they were not set up through the runner
Fixes angular#2456
1 parent b506aac commit 7b9f505

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

lib/driverProviders/driverProvider.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ DriverProvider.prototype.getExistingDrivers = function() {
3232
* @return webdriver instance
3333
*/
3434
DriverProvider.prototype.getNewDriver = function() {
35+
console.log(this.config_.capabilities);
36+
console.log(webdriver.log);
3537
var newDriver = new webdriver.Builder().
3638
usingServer(this.config_.seleniumAddress).
3739
withCapabilities(this.config_.capabilities).

lib/protractor.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var ElementArrayFinder = require('./element').ElementArrayFinder;
77
var ElementFinder = require('./element').ElementFinder;
88
var build$ = require('./element').build$;
99
var build$$ = require('./element').build$$;
10+
var Plugins = require('./plugins');
1011

1112
var clientSideScripts = require('./clientsidescripts.js');
1213
var ProtractorBy = require('./locators.js').ProtractorBy;
@@ -189,6 +190,13 @@ var Protractor = function(webdriverInstance, opt_baseUrl, opt_rootElement) {
189190
*/
190191
this.ready = null;
191192

193+
/*
194+
* Set by the runner.
195+
*
196+
* @type {Plugins} Object containing plugin funtions from config.
197+
*/
198+
this.plugins_ = new Plugins({});
199+
192200
/**
193201
* The reset URL to use between page loads.
194202
*

spec/basic/lib_spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ describe('protractor library', function() {
108108
toEqual('repeater');
109109
});
110110

111+
it('should allow self-wrapped webdriver instances', function() {
112+
var driver = protractor.wrapDriver(browser.driver);
113+
driver.get('https://angularjs.org/');
114+
});
115+
111116
describe('helper functions', function() {
112117
it('should get the absolute URL', function() {
113118
browser.get('index.html');

spec/multiConf.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ exports.config = {
1212
],
1313

1414
multiCapabilities: [{
15-
'browserName': 'chrome'
16-
}, {
17-
'browserName': 'firefox'
15+
'browserName': 'firefox',
16+
17+
'webdriver.log.driver.ignore': true,
18+
'webdriver.log.server.ignore': true,
19+
'webdriver.log.browser.ignore': true
1820
}],
1921

2022
baseUrl: env.baseUrl,

0 commit comments

Comments
 (0)