Skip to content Skip to sidebar Skip to footer

Can't Access Array From Within Protractor Callback

I'm new to both protractor and javascript. I ran into a scoping issue which I can't figure out. In the code segment below, the first array access statement works but the second doe

Solution 1:

You just need to change

... .getText().then(function(txt){ ... });

to

... .getText().then((txt) => { ... });

It's called fat arrow function and it does not have it's own this so you can access your array.

Post a Comment for "Can't Access Array From Within Protractor Callback"