Skip to content

Instantly share code, notes, and snippets.

@antony
Last active June 9, 2016 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antony/ce4f7f97fbc24a28bb0d829a606ef327 to your computer and use it in GitHub Desktop.
Save antony/ce4f7f97fbc24a28bb0d829a606ef327 to your computer and use it in GitHub Desktop.
Dynamic Selenium Page Model example in NodeJS / JavaScript
'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