Setting ion-textarea value in protractor


#1

Hi,

I’m trying to write some e2e tests for my Ionic app, and attempting to fill out a ion-textarea programatically like so:

var.agendaField = $('ion-textarea.agenda-text-area');
agendaField.sendKeys("Item 1\r\nItem 2\r\nItem 3");

However, I get the following error:

WebDriverError: unknown error: cannot focus element

Can anyone help? I’m tearing my hair out here.


#2

For the benefit of future Googlers (hi!), I ended up clicking on the actual element and then sending keypresses to the browser like so:

var agendaField = $('ion-textarea.agenda-text-area');

agendaField.click().then(() => {
  return browser.actions().sendKeys(
    'Item 1', 
    protractor.Key.ENTER, 
    'Item 2', 
    protractor.Key.ENTER, 
   'Item 3'
  ).perform();
})