elementByXPath returns NoSuchElement error on view level elements


I’ve been working with Appium a little over two weeks now. I’m developing tests for a React Native mobile application, and am running into issues with the Android tests (iOS is working fine so far). The issue I’m currently facing is getting a return from the XPath to a particular element. I can verify the path through the Appium GUI, but it returns a NoElementError.

The current XPath to my element is


In trying to debug the issue, I’ve walked through the path one-by-one and that the first three paths an element. It isn’t until android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.view.View[1] that the NoSuchElement error is thrown.

I have been researching this issue for about a day and haven’t had any luck. Was hoping someone on the forums could point me in the right direction, or provide some information I haven’t discovered yet.

In case it helps, here is the code I’m trying to run:

// driver and mocha setup cut for brevity
const header = '//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.view.View[1]/android.view.View[1]/android.view.View[1]/android.widget.TextView[2]';
locateLoginHeader = () => driver.elementByXPath(header);

it('renders', () => {
	return locateLoginHeader().then(elem => {
		return expect(elem).to.exist;