6

When I am attempting to run my Protractor tests from the command line all of my tests fail because whenever I try to access the protractor object it does not have the methods I need. The exact error is:

TypeError: Object # has no method 'getInstance'

So this seems to have been a reported and fixed issue, yet I cannot seem to resolve my particular situation. It also seems to be semi-related to this question, but because it arose for me after updating my node_modules I feel like my underlying issue is different. Up until updating my Protractor everything worked just fine.

I installed it globally and used npm link protractor to link my local instance to my global instance (located at /usr/local/lib/node_modules/protractor), but I still for the life of me cannot figure out what is wrong.

The exact code where I'm calling protractor is a page object file that looks like:

module.exports = function() {

    var ptor = protractor.getInstance();

    this.get = function() {
        browser.get('http://localhost');
        this.title = ptor.getTitle();
    };

};

The code instantiating the page object is as follows:

var Login = require('./pageObjects/Login.po.js');
...
var LoginPage = new Login();

Pass the url name in the url template tag:

"{% url 'cal_main' year|add:'1' %}" 
4

1 に答える 1

16

もう呼び出す必要はありませprotractor.getInstance()ん。グローバルに利用可能なbrowserオブジェクトを使用してください:

this.title = browser.getTitle();

そして、はい、これは の重大な変更です1.5.0。次を参照してください。

于 2014-12-29T14:37:15.693 に答える