Canonical way to define page objects in Protractor
问题 We've been using the Page Object pattern for quite a while. It definitely helps to organize the end-to-end tests and makes tests more readable and clean. As Using Page Objects to Organize Tests Protractor documentation page shows us, we are defining every page object as a function and use new to "instantiate" it: "use strict"; var HeaderPage = function () { this.logo = element(by.css("div.navbar-header img")); } module.exports = HeaderPage; Usage: "use strict"; var HeaderPage = require("./..