title: Can't find an element on a webview page of an iOS native app using Appium
body: <p>I have a native app which opens few web-view pages. I'm running appium on the app to do some automation test on a web-view page that I need to scroll down to find the username and password fields. I tried all the suggestion I can find online, and it doesn't work. Can anyone help? 
  I'm running:
  Appium v1.3.5
  iOS 8.1</p>
  
  <p>Here is my code:</p>
  
  <pre><code>// switch to webview
  
  Thread.sleep(6000);
  final Set&lt;String&gt; contextNames = driver.getContextHandles();
  for (final String contextName : contextNames) {
    System.out.println(contextName);
    if (contextName.contains("WEBVIEW")) {
      driver.context(contextName);
    }
  }
  
  Thread.sleep(6000);
  WebElement x = driver.findElement(By.cssSelector("Username *"));
  assertTrue(x.isDisplayed());
  </code></pre>
  
  <p>Here is the element I try to scroll to and enter username</p>
  
  <pre><code>     &lt;AppiumAUT&gt;
         &lt;UIAApplication name="Demo A" label="Demo A" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0" x="0" y="24.125" width="375" height="642.1875"&gt;    
          &lt;UIAWindow name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/2" x="0" y="0.6875" width="375" height="665.625"&gt;
          &lt;UIAScrollView name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/2/1" x="29.296875" y="40.53125" width="316.40625" height="548.4375"&gt;
              &lt;UIAWebView name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/2/1/0" x="29.296875" y="40.53125" width="684.375" height="1170.703125"&gt;
                  &lt;UIAStaticText name="Username *" label="Username *" value="" dom="[object Object]" enabled="true" valid="true" visible="false" hint="" path="/0/2/1/0/15" x="94.921875" y="783.5" width="92.578125" height="22.265625"&gt;
                  &lt;/UIAStaticText&gt;
                  &lt;UIATextField name="" label="" value="" dom="[object Object]" enabled="true" valid="true" visible="false" hint="" path="/0/2/1/0/16" x="94.921875" y="811.625" width="604.6875" height="46.875"&gt;
                  &lt;/UIATextField&gt;
  </code></pre>
  
  <p>Here is the error message: </p>
  
  <pre><code>org.openqa.selenium.InvalidElementStateException: SyntaxError: DOM Exception   12 (WARNING: The server did not provide any stacktrace information)Command duration or timeout: 22 milliseconds
  </code></pre>
  
  <p>I have tried the following and doesn't work:</p>
  
  <ol>
  <li>switch to the window first using <code>driver.switchTo().window("WEBVIEW_1");</code></li>
  <li>use <code>driver.findElement(By.id("Username *"))</code></li>
  <li>use <code>driver.findElement(By
      .xpath("//input[@name='Username *']"));</code></li>
  <li>use <code>driver.findElement(By   .xpath("//UIAApplication[1]/UIAWindow[3]/UIAScrollView[1]/UIAWebView[1]/UIAStaticText[14]"));</code></li>
  </ol>
  
  <p>I also tried to scroll to it first:</p>
  
  <ol>
  <li>use just <code>scollto: driver.scrollTo("Username *");</code></li>
  <li>`((JavascriptExecutor) driver).executeScript(
  
  <ul>
  <li>"arguments[0].scrollIntoView(true);", driver.findElement(By.name("Username *")));`</li>
  </ul></li>
  </ol>
  
  <p>Error message are either NoSuchElement or the one above. </p>
  
  <p>Please help! Thanks!</p>