title: appium cannot type in textfield
body: <p>I'm using nativescript and nativescript-dev-appium to perform end to end tests and I'm trying to enter some text into a text field.</p>
  
  <p>The textField in my xml layout;</p>
  
  <pre><code>      &lt;StackLayout padding="10"&gt;
             &lt;Label text="Date of Purchase"&gt;&lt;/Label&gt;
             &lt;DatePickerField hint="Select Date" [(ngModel)]="_dataItem.date_of_purchase"&gt;&lt;/DatePickerField&gt;
        &lt;/StackLayout&gt;
  
        &lt;StackLayout padding="10"&gt;
          &lt;Label text="Name"&gt;&lt;/Label&gt;
          &lt;TextField automationText="name" hint="Asset Name" [(ngModel)]="_dataItem.name" class="input"&gt;
          &lt;/TextField&gt;
        &lt;/StackLayout&gt;
  </code></pre>
  
  <p>My spec;</p>
  
  <pre><code>import { AppiumDriver, createDriver, SearchOptions, nsCapabilities } from "nativescript-dev-appium";
  import { assert } from "chai";
  const addContext = require('mochawesome/addContext');
  
  describe("sample scenario", () =&gt; {
      let driver: AppiumDriver;
  
      before(async function(){
          nsCapabilities.testReporter.context = this; 
          driver = await createDriver();
      });
  
      after(async function () {
          await driver.quit();
          console.log("Quit driver!");
      });
  
      afterEach(async function () {
          if (this.currentTest.state === "failed") {
              await driver.logTestArtifacts(this.currentTest.title);
          }
      });
  
      it("should find an element by text", async function () {
          const nameField = await driver.findElementByAutomationText("name");
          await nameField.sendKeys("3d printer");
  
          const btnTap = await driver.findElementByAutomationText("create");
          await btnTap.click();
      });
  });
  </code></pre>
  
  <p>Error I get;</p>
  
  <pre><code>Error: [element.sendKeys("3d printer")] Error response status: 12, InvalidElementState - An element command could not be completed because the element is in an invalid state (e.g. attempting to click a disabled element). 
  Selenium error: io.appium.uiautomator2.common.exceptions.InvalidElementStateException: Cannot set the element to '3d printer'. 
  Did you interact with the correct element? at io.appium.uiautomator2.handler.SendKeysToElement.safeHandle(SendKeysToElement.java:97) at 
  io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:37) at 
  io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:252) at 
  io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:243) at 
  io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44) at 
  io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366) at 
  io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352) at 
  io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345) at 
  io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) at 
  io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366) at 
  io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352) at 
  io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345) at 
  io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435) at 
  io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) at 
  io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) at 
  io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250) at 
  io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366) at 
  io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352) at 
  io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345) at 
  io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294) at 
  io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366) at 
  io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352) at 
  io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911) at 
  io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) at 
  io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:611) at 
  io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:552) at 
  io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:466) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438) at 
  io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140) at 
  io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) at java.lang.Thread.run(Thread.java:761)
  </code></pre>
  
  <p>I've also tried nameField.type("3d printer") and get the same error.</p>
  
  <p><strong>Update: Try Xpath</strong></p>
  
  <pre><code>it("should find an element by text", async function () {
      const nameField = await driver.findElementByXPath("//*[@automationText='name']");
      await nameField.click();
      await nameField.sendKeys("3d printer");
  </code></pre>
  
  <p>Got error</p>
  
  <pre><code>Error: [waitForElementByXPath("//*[@automationText='name']",5000)] Element condition wasn't satisfied!
  </code></pre>
  
  <p><strong>Update: find by class name 'textfield' works</strong></p>
  
  <p>If I use the following in my test and the first text field which appears on the form is the name field then this works.</p>
  
  <pre><code>    const nameField = await driver.findElementByClassName(driver.locators.getElementByName("textfield"));
      await nameField.sendKeys("3d printer");
  </code></pre>
  
  <p>But how do I select the text field if it's not the first field?</p>