Comments (5)
This looks totally right to me -- if you were up for making the changes and submitting a pull request, I would be happy merge it in! Thanks.
from wd.
No, it is wrong. It would be right if you were to write
webdriver.prototype = EventEmitter.prototype;
Then you would still have to call the EventEmitter constructor in the webdriver constructor.
new EventEmitter(); creates an instances, you can't inherit instance of object. Well you can obviously, but is wrong and doesn't work as it should except in the case where you use one webdriver instance in the lifetime of the app.
I fixed it myself and as you can see above the fix is three lines long and I tested it. It would take you less time to copy paste it than for me to fork your repository, fix, push, submit pull request, then you need to merge the changes, etc. Just copy the lines above. Or here is the whole begining of the file webdriver.js
var EventEmitter = require('events').EventEmitter;
var async = require("async");
var _ = require("underscore");
var fs = require("fs");
var element = require('./element').element;
var request = require('request');
var __slice = Array.prototype.slice;
var utils = require("./utils");
var JSONWIRE_ERRORS = require('./jsonwire-errors.js');
var MAX_ERROR_LENGTH = 500;
var util = require( 'util' );
// webdriver client main class
// WdConfig is an option object containing the following fields:
// host,port, username, accessKey
var webdriver = module.exports = function(remoteWdConfig) {
EventEmitter.call( this );
this.sessionID = null;
this.username = remoteWdConfig.username || process.env.SAUCE_USERNAME;
this.accessKey = remoteWdConfig.accessKey || process.env.SAUCE_ACCESS_KEY;
this.basePath = (remoteWdConfig.path || '/wd/hub');
this.https = (remoteWdConfig.https || false);
// default
this.options = {
host: remoteWdConfig.host || '127.0.0.1'
, port: remoteWdConfig.port || 4444
, path: (this.basePath + '/session').replace('//', '/')
};
this.defaultCapabilities = {
browserName: 'firefox'
, version: ''
, javascriptEnabled: true
, platform: 'ANY'
};
// saucelabs default
if ((this.username) && (this.accessKey)) {
this.defaultCapabilities.platform = 'VISTA';
}
};
//inherit from EventEmitter
util.inherits( webdriver, EventEmitter );
from wd.
I agree that this a better way to do this, however having applied your changes the wd tests are now breaking:
https://travis-ci.org/admc/wd/builds/5824508
I don't have time at the moment to dive in and debug this, any thoughts would be appreciated.
I'm running 'make test' locally with selenium 2.31: http://docs.seleniumhq.org/download/
and 'make test_saucelabs' the way travis is and seeing the same error.
Adam
from wd.
I tried to spot something but couldn't find anything that doesn't look right, sorry. I'm still new to WebDriver. Maybe something will popup when I start using it soon.
from wd.
Made the change, @admc, it looks like you had messed up the wd remote configuration (plus there was a missing callback in one of the new test).
from wd.
Related Issues (20)
- waitForElementByXPath/id/name does not poll as per the poll frequency provided.
- I need help getting Android to Scroll WD Appium HOT 14
- How to select spinner value in wd
- synchronous REPL mode?
- promiseChainRemote does not allow https HOT 1
- execute script with arguments not work
- 404 HTTP appium No route found HOT 1
- Running test suites
- promiseChainRemote do not work
- can't work with selenium grid
- WaitForElement -functions do not apply timeout on element lookup
- Consider removing request (as it is deprecated) HOT 1
- Two vulnerabilities are introduced in the package HOT 3
- client.moveTo() is not working on latest version of word 2106 HOT 1
- WD does not get the session id with appium. HOT 1
- is v1.14.0 tag missing?
- Getting 'npm ERR! Cannot read properties of null (reading 'pickAlgorithm')' when running `npm install wd` HOT 1
- [Appium] W3C capabilities should be provided HOT 1
- Missing typescript support HOT 1
- Request has been deprecated and is raising security vulnerabilities HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wd.