1
votes

I have a problem to use the element.all function. My guess is, that it has problems with an id. I know an id should be used one time only, but I am testing the software only and have no possibility to change this id to a class. So maybe there is a solution to get it with element.all and then process with the index function.

let buttons = element.all(by.id('wanted id'));

When this code snippet is invoked. It says:

element.all is not a function.

When I use only element it works, but I cannot use the index function.

Thanks for your help

1
You didn't close parenthesis in buttons. - Kacper
oh sorry, in the original snippet they are closed. Otherwise protractor wouldn't start. - Inuff
hmm this piece of code looks correct. Can you paste some more code? - Kacper
Please see my answer below. This worked for me. - Inuff

1 Answers

0
votes

I could solve the problem by using all, without element before.

all(by.id('wanted id')).then( elem => {
      ...
});