Whenever I try to run my Protractor tests from the command line, all of them fail because the protractor
object does not have the necessary methods. The error message I receive is:
TypeError: Object # has no method 'getInstance'
Although this issue has been reported and fixed, I am still unable to resolve it in my specific scenario. It seems somewhat related to this question, but since it occurred for me after updating my node_modules, I suspect there may be a different underlying problem. Everything was working fine before the update.
I installed Protractor globally and used npm link protractor
to connect my local instance with the global one (located at
/usr/local/lib/node_modules/protractor
). However, I am still struggling to identify the issue.
The section of code where I encounter the protractor
object is within a page object file that looks like this:
module.exports = function() {
var ptor = protractor.getInstance();
this.get = function() {
browser.get('http://localhost');
this.title = ptor.getTitle();
};
};
The code that initializes the page object is as follows:
var Login = require('./pageObjects/Login.po.js');
...
var LoginPage = new Login();