Protractor: Angular2/4 Forms Model doesn-t get properly updated on element.clear()

Created on 20 Jun 2017  路  5Comments  路  Source: angular/protractor

Hi there!

It looks like there is a synchronization problem with Angular2(4) Forms when clearing an input field with element.clear().

A detailed description of the issue can be found here.

Best

Bug Report

  • Node Version: v7.8.0
  • Protractor Version: 5.1.0
  • Angular Version: 4.0.0
  • Browser(s): Chrome
  • Operating System and Version Ubuntu 16.10 LTS

Most helpful comment

A similar problem existed ~4 years ago.

The workaround https://github.com/angular/protractor/issues/301#issuecomment-32651201 fixed it for me also on angular 5 / protractor 5.2.0.

All 5 comments

I have noticed this as well when interacting with WYSIWYG editors. If the editor creates a default content containing a

element clear will remove everything and affect the validity of the editor.

Any solution ?

A similar problem existed ~4 years ago.

The workaround https://github.com/angular/protractor/issues/301#issuecomment-32651201 fixed it for me also on angular 5 / protractor 5.2.0.

This is the "solution" we use:

field.clear();
field.sendKeys(' ');
field.sendKeys(protractor.Key.BACK_SPACE);

This has been fixed and we also have tests for it, see https://github.com/angular/protractor/commit/b93c8310f8aaccbebed672eeb42e156d47d16f0a

Was this page helpful?
0 / 5 - 0 ratings