Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Clearing inputs doesn't work with type=number. #510

Closed
rsboarder opened this issue Feb 11, 2014 · 2 comments
Closed

Clearing inputs doesn't work with type=number. #510

rsboarder opened this issue Feb 11, 2014 · 2 comments
Milestone

Comments

@rsboarder
Copy link
Contributor

<input type="number" min="0" id="limit" ng-model="limit" required>
var input = element(by.input('limit'));
var generatedNum = generateNum(4);

input.sendKeys(generateString()).then(function () {
  expect(input.getAttribute('class')).toMatch(/ng-invalid/gi);
});

input.clear(); // this doesn't clear input

input.sendKeys(generatedNum).then(function () {
  refreshModel().then(function () {
    expect(model.limit).toBe(generatedNum);
  });
});

Changing type to text fixes everything. I don't know, maybe it's a webdriver bug.

@juliemr
Copy link
Member

juliemr commented Mar 27, 2014

I no longer see this issue. Please open a new issue if it remains a problem!

@amwill1
Copy link

amwill1 commented Jan 26, 2016

this is still an issue for me. I've tried the suggestions in this question and did

    elem.click();
    browser.sleep(1000);
    elem.clear().sendKeys(val);

but this solution only seems to work sometimes. often what happens is the input gets cleared but then fills in the previous value before sending the new value. i'm not sure what to do. i just updated to 3.0.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants