I'm trying to write e2e tests for our application based on angular and angular material. We are using chromedriver 2.16, selenium 2.46 and the newest protractor.net. The problem is, when I want to use sendKeys method, selenium doesn't send all of them all the time - it's random, sometimes it sends the whole value, sometimes 1-3 characters.
Here is the code: 1st with selenium
var nameInput = webDriver.FindElement(By.Id('SizeTemplateName'));
nameInput.Click();
nameInput.Clear();
nameInput.SendKeys('some random value 123 456 789');
2nd with protractor.net
var nameInput = angularWebDriver.FindElement(NgBy.Model('vm.sizeTemplate.name'));
nameInput.Click();
nameInput.Clear();
nameInput.SendKeys('some random value 123 456 789');
None of the approaches work. Any ideas?
I had same problem. Try to use this
private static void sendKeys(IWebElement element, string text)
{
element.Click();
Actions actions = new Actions(driver);
foreach (char c in text)
{
actions.SendKeys(c.ToString())
.Perform();
}
}
Usage in code
sendKeys(nameInput, "some random value 123 456 789")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With