I'm using protractor and i can not understand why when i try to get something by css it works but if i try to get it with id it does not work.
Error message on the btnLogin line
TypeError: undefined is not a function
Some part of the code
browser.get('http://localhost:3000/#!/signin');
expect(element.all(by.css('.btn-social')).count()).toBe(2);
expect(element(by.id('btnLogin').count())).toBe(1);
if i try to do something in a input it works
element(by.id('username')).clear().sendKeys('something');
html of button
<button id="btnLogin" class="btn btn-lg btn-primary btn-block" type="submit">Login</button>
I have no idea what i'm doing wrong :S
You are calling count()
on an ElementFinder
- the result of element()
call.
Instead, if you really want to check the count, you need element.all()
:
expect(element.all(by.id('btnLogin').count())).toBe(1);