Sendkeys enters a jumbled text

I am trying to send input using sendkeys and it enters jumbled text. Could someone please help me out with this

This issue usually occurs as the text is entered very quickly using sendkeys. This usually jumbles the text entered. You could use a for loop to enter the text and add a small delay after each value is entered. I am sharing a sample code written in nodejs cucumber

this.When(/^I enter card details “([^”]*)"$/,{timeout: 600 * 1000}, function (cardNumber, next) {

var self=this;
self.driver.sleep(300);
  self.driver
  .switchTo()
  .frame(valueFrameIndex)
  .then(function () {
    var i=0;
    for(i; i<=15; i++)
    {
    var a=value[i]; 
    self.driver
      .findElement({ name: "webelement" })
      .sendKeys(a);
      self.driver.sleep(30)
    }
    });

this.driver .switchTo() .defaultContent() .then(next); });

}

Note: Here we have ran the for loop for 16 times as we are entering a card number.

1 Like