WebElement.clear() Does Not Update Model
See original GitHub issueCalling WebElement.clear() on an input element does not appear to update the associated model.
View:
<input ng-model="foo">
<div>{{foo}}</div>
Spec:
it("should update the model", function(){
var input = element(by.css("input"));
input.sendKeys("bar");
input.clear();
expect(element(by.css("div")).getInnerHtml()).toBe(""); // Fails, because it's still "bar"
});
Issue Analytics
- State:
- Created 10 years ago
- Reactions:2
- Comments:26 (8 by maintainers)
Top Results From Across the Web
selenium clear() command doesn't clear the element
Here is the issue: I cleared a text field using webelement.clear() method, later while executing next command (click event), the text area I...
Read more >Will the variable be still referencing the same webelement on ...
No, you will never get stale element, element is only initialized when you do something with it. You can Click, Refresh page, Click...
Read more >Check Visibility of Web Elements Using Various Types ...
Akin to above methods, we have a method referenced as “isSelected()” which tests if the specified web element is selected or not.
Read more >How To Type, Retrieve and Clear values from the Text box ...
Interface WebElement consists of a method “sendKeys()” which is used ... sendKeys() method does not clear the existing text of an input box....
Read more >webdriver.WebElement.clear - Protractor
Schedules a command to clear the value of this element. This command has no effect if the underlying DOM element is neither a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had a similar issue with a directive I was using and sendKeys not updating the model. This solution worked for me though I am not sure if it will work for you all:
I can confirm this is still an issue with Angular 7.2.3 and Protractor 5.4.0 on 73.0.3683.103.