@Override
            public AndroidElement answer(InvocationOnMock invocationOnMock) throws Throwable {
                AndroidNativeElement element = mock(AndroidNativeElement.class);

                when(element.getView()).thenReturn((ViewGroup) invocationOnMock.getArguments()[0]);

                return element;
            }
Helper to do the actual searching.
selendroid-server/src/test/java/io/selendroid/server/model/internal/AbstractNativeElementContextTest.java