title: Appium: Right way to find elements on Android screen
body: <p>I want to use <a href="http://appium.io/slate/en/master/?ruby#toc_0" rel="nofollow">Appium</a> to make automated testing for my Android app. I am writing tests in C#. I've done fair share in my searching but couldn't find a good documentation explaining how to access elements on Android screen. I know there are methods like <code>FindElementsByXPath</code>, <code>FindElementById</code>, <code>FindElementByName</code> etc, but I am not able to use those methods right way as I am getting exceptions. Please read questions below:</p>
  
  <p>1) To use <code>FindElementsByXPath</code> method I need to know <code>PageSource</code> in advance which can be obtained only using <code>driver.PageSource</code>. Is there any convenient way to know <code>PageSource</code> prior to running tests so that I can pass XPath string as a parameter to <code>FindElementsByXPath</code>?</p>
  
  <p>2) I've <code>EditTextView</code> on Android screen. In layout it is declared as follows:</p>
  
  <pre><code>&lt;EditText
          android:id="@+id/password"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:ems="10"
          android:inputType="textPassword"
          android:textSize="12dp"
          android:imeOptions="actionDone|flagNoExtractUi" 
          &gt;
  </code></pre>
  
  <p>How shall I access this <code>EditTextView</code> using it's id i.e. 'password' while writing test?</p>
  
  <p>3) Is it possible to set text to <code>EditTextView</code> programatically? If yes, how to do it?</p>
  
  <p>Thanks for taking time to read whole question. If you have any resources explaining how to access and manipulate elements on Android screen while writing <a href="http://appium.io/slate/en/master/?ruby#toc_0" rel="nofollow">Appium</a> tests, please provide me the same.</p>