protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Is it possible to call a angular function in the controller?

Open Douwe92 opened this issue 13 years ago • 1 comments

I want to call a fucntion thats called navigateTo, would that be possible?

Douwe92 avatar Oct 16 '13 12:10 Douwe92

I'm not sure what you mean by 'in the controller'. navigateTo is a function in the scenario runner - it is not present in AngularJS or in Protractor.

In general, your end to end tests should not be directly calling functions in your test code. However, Protractor does allow you to evaluate statements in the context of an element. So, if your element with id 'foo' has a function on the scope 'doStuff', you could call:

ptor.findElement(protractor.By.id('foo')).evaluate('doStuff()');

juliemr avatar Oct 16 '13 18:10 juliemr