2

I'm currently testing on Internet Explorer 8. My script types in a username and password and logs into a website.

The problem is that the sendkeys() function takes forever to finish. The username is only 8 characters long, but takes about 30 - 40 seconds to enter in. As my tests expand, this is going to translate into tests that take forever to complete.

How can I speed up this operation? I'd prefer not to use native javascript to enter in data.

nirvdrum
  • 2,317
  • 17
  • 26
Brett McLain
  • 1,980
  • 2
  • 13
  • 32
  • 2
    possible duplicate of [Is there any way to optimize / speed up the sending of data to a UI with Protractor?](http://stackoverflow.com/questions/25689090/is-there-any-way-to-optimize-speed-up-the-sending-of-data-to-a-ui-with-protrac) – durron597 Sep 09 '15 at 13:57

2 Answers2

3

You basically have two options for entering text in fields:

  1. sendkeys()
  2. javascript

The first isn't working for you, and you've decided against the second for whatever reason, which leaves just one other thing you could try - a different IE configuration. Try turning protected mode off for all zones (or on if you have it off), sometimes that can make a difference for performance.

Anders
  • 14,647
  • 4
  • 30
  • 41
1

In order to make the sendKeys work, I used the following method:

  • use JavaScript to set the value of the input but leave out the last character
  • use sendKeys to enter the missing character

An example of entering an IBAN CH1709000000147117606 looks like this

    browser.executeAsyncScript(function(callback){
        document.getElementsByName("kontoNummer")[0].value = "CH170900000014711760";
        callback();
    }).then(page.kontoNummer.sendKeys('6'));

The reason why the last character is still entered via sendKeys is because it sets the focus on the form element and allows for correct event triggering

Micha Roon
  • 3,698
  • 1
  • 26
  • 47