Last active
June 9, 2016 15:56
-
-
Save antony/ce4f7f97fbc24a28bb0d829a606ef327 to your computer and use it in GitHub Desktop.
Dynamic Selenium Page Model example in NodeJS / JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
class MagicPage { | |
constructor () { | |
var contents = Object.keys(this.getContent()) | |
contents.map((key) => { | |
this[key] = this.getContent()[key] | |
}) | |
} | |
} | |
class ObviousPage extends MagicPage { | |
getContent () { | |
return { | |
button: () => { return 'i-could-be-anything' } | |
} | |
} | |
} | |
var page = new ObviousPage() | |
console.log(page.button()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment