Last active
October 21, 2016 09:54
-
-
Save anilreddy/b7d482b6106cd816e3e2761acd7c257f to your computer and use it in GitHub Desktop.
How to use Javascript executor in protractor instead of sendkeys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Text to be entered | |
var text = 'My text value'; | |
// Locator | |
var input = element(by.model('angularProperty')); | |
// Now you can use like this | |
setValue(text, input); | |
// Using this function | |
this.setValue = function (inputText, locator) { | |
browser.executeScript("arguments[0].setAttribute('value', '" + inputText +"')", locator); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment