Protractor can't find element by binding $ctrl

Ralf de Kleine

I have a little experience using Protractor. Using by.css, by.name and by.id I can select elements but somehow my tests are failing when using by.binding.

Am I missing something obvious?

View:

<input type="text" ng-model="$ctrl.speaker.firstName" maxlength="60" />

Protractor test:

var EC = protractor.ExpectedConditions;
let firstName = element(by.binding('$ctrl.speaker.firstName'));
browser.driver.wait(EC.presenceOf(firstName), 2000, 'find element firstname');
firstName.sendKeys('Bill');

Testresult:

Failures:
1) Speakers should ..
  Message:
    Failed: find element firstname
    Wait timed out after 2003ms
  Stack:
    TimeoutError: find element firstname

There are some SO q&a's but they don't help me in finding whats wrong.

Update

Ok, this was pretty obvious by.binding should be by.model.

Akash Chavan

You should use by.model() method.

let firstName = element(by.model('$ctrl.speaker.firstName'));

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

AngularJS Protractor element by.model can't find element?

From Dev

protractor can not find element with id

From Dev

Protractor: Can you select a binding without wrapping it in an element?

From Dev

Protractor: can't get repeater element

From Dev

Protractor: can't get repeater element

From Dev

Protractor can't find element that has beeen found 2 tests before

From Dev

Protractor can't find element that has beeen found 2 tests before

From Dev

CKEditor + Protractor: Testing with Protractor can't find CKEditor instance

From Dev

Protractor: Find Element by Attribute

From Dev

Protractor - find element in iframe

From Dev

Protractor Find and Click Element

From Dev

Protractor can't click on embedded <span> inside <a> element

From Dev

Alloy data binding can't find collection

From Dev

Why can't Protractor find Angular on an automatically initialized Angular site?

From Dev

Selenium can't find element

From Dev

Javascript: can't find element

From Dev

Can't find element in frame

From Dev

Can't find element in frame

From Dev

Can't find an element by "querySelector"

From Dev

Can't find elements of element

From Dev

Protractor find element inside a repeater

From Dev

how to Find element Locator in Protractor

From Dev

Protractor: Async timing out, I think because it won't find an element

From Dev

Can't find DOM element in jQuery

From Dev

IndexOf can't find last element in a List

From Dev

why can't find/parse this element in HTML?

From Dev

Can't find specific element in LinkedListNode

From Dev

Selenium IDE can't find an element

From Dev

Can't find an element Selenium Python