1

Inconsistently, partial text is being sent when using SendKeys and causes a particular spec to fail. Below is the test that needs to happen for the other tests to past successfully

it('should select a template report', function() {
    reports.createTemplateBtn.click();
    reports.selectTemplate.click();
    browser.switchTo().activeElement().sendKeys('Guest RSVP Status' + protractor.Key.ENTER);
    browser.sleep(1000);
    reports.startBtn.click();
});

The test is clicking a field (Select Template) which then shows a drop down to type in the type of template to be used. The issue is with sending 'Guest RSVP Status'. Inconsistently, only portions of the phrase will be sent and causes the rest to error out. Is there a better way to implement Send Keys and/or should sleeps be added? 1/5 times the full text is sent successfully.

Update: slowType errors out below. Sleep is not a function.

function slowType(elm, keys, delay){ var action = browser.actions().mouseMove(elm).click(); for (var i = 0; i < keys.length; i++) { action = action.sendKeys(keys[i]).sleep(delay); } return action.perform(); }

  • Have you checked to see if protractor has a way to wait until the current element value is what you want it to be? – Kate Paulk Sep 28 '17 at 14:52
  • Could it be that there is a "slow" validation going on during the field modification? What if you try to slowtype into the field? – alecxe Sep 28 '17 at 15:44
  • @alecxe there is a validation occurring. With the recommendation, I am using the following but receiving a failure action.sendKeys(...)sleep is not a function Original post updated with code. – kylokyler Sep 28 '17 at 17:50
  • can you try reports.selectTemplate.click().sendKeys('Guest RSVP Status' + protractor.Key.ENTER);? Because it seems the element you click is the same element you want the text to be passed on. – Ernst Zwingli Nov 27 '17 at 20:25
  • @ErnstZwingli I've tried that but it is still inconsistently successful. – kylokyler Nov 27 '17 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.