title: Android::android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching
body: <p>This is the first time I am running the espresso and I am stuck at this issue</p>
  
  <blockquote>
    <p>Issue::
    android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: (with id: edu.gatech.seclass.sdpguessit:id/login_page_username_field and with text: is "Enter Username" and Child at position 1 in parent Child at position 0 in parent with id: 16908290 and is displayed on the screen to the user)</p>
  </blockquote>
  
  <p>This is my code below:</p>
  
  <pre><code>package edu.gatech.seclass.sdpguessit.ui;
  
  
  import android.support.test.espresso.DataInteraction;
  import android.support.test.espresso.ViewInteraction;
  import android.support.test.rule.ActivityTestRule;
  import android.support.test.runner.AndroidJUnit4;
  import android.test.suitebuilder.annotation.LargeTest;
  import android.view.View;
  import android.view.ViewGroup;
  import android.view.ViewParent;
  
  import static android.support.test.InstrumentationRegistry.getInstrumentation;
  import static android.support.test.espresso.Espresso.onData;
  import static android.support.test.espresso.Espresso.onView;
  import static android.support.test.espresso.Espresso.pressBack;
  import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
  import static android.support.test.espresso.action.ViewActions.*;
  import static android.support.test.espresso.assertion.ViewAssertions.*;
  import static android.support.test.espresso.matcher.ViewMatchers.*;
  
  import edu.gatech.seclass.sdpguessit.R;
  
  import org.hamcrest.Description;
  import org.hamcrest.Matcher;
  import org.hamcrest.TypeSafeMatcher;
  import org.hamcrest.core.IsInstanceOf;
  import org.junit.Rule;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  
  import static org.hamcrest.Matchers.allOf;
  import static org.hamcrest.Matchers.anything;
  import static org.hamcrest.Matchers.is;
  
  @LargeTest
  @RunWith(AndroidJUnit4.class)
  public class LoginActivityTest {
  
      @Rule
      public ActivityTestRule&lt;LoginActivity&gt; mActivityTestRule = new ActivityTestRule&lt;&gt;(LoginActivity.class);
  
      @Test
      public void loginActivityTest() {
          ViewInteraction editText = onView(
                  allOf(withId(R.id.login_page_username_field), withText("Enter Username"),
                          childAtPosition(
                                  childAtPosition(
                                          withId(android.R.id.content),
                                          0),
                                  1),
                          isDisplayed()));
          editText.check(matches(withText("Enter Username")));
  
          ViewInteraction button = onView(
                  allOf(withId(R.id.login_button),
                          childAtPosition(
                                  childAtPosition(
                                          withId(android.R.id.content),
                                          0),
                                  2),
                          isDisplayed()));
          button.check(matches(isDisplayed()));
  
          ViewInteraction button2 = onView(
                  allOf(withId(R.id.create_player_button),
                          childAtPosition(
                                  childAtPosition(
                                          withId(android.R.id.content),
                                          0),
                                  3),
                          isDisplayed()));
          button2.check(matches(isDisplayed()));
  
      }
  
      private static Matcher&lt;View&gt; childAtPosition(
              final Matcher&lt;View&gt; parentMatcher, final int position) {
  
          return new TypeSafeMatcher&lt;View&gt;() {
              @Override
              public void describeTo(Description description) {
                  description.appendText("Child at position " + position + " in parent ");
                  parentMatcher.describeTo(description);
              }
  
              @Override
              public boolean matchesSafely(View view) {
                  ViewParent parent = view.getParent();
                  return parent instanceof ViewGroup &amp;&amp; parentMatcher.matches(parent)
                          &amp;&amp; view.equals(((ViewGroup) parent).getChildAt(position));`enter code here`
              }
          };
      }
  }
  </code></pre>
  
  <p>How can I solve this?</p>