RobotiumTech / robotium

Android UI Testing
http://www.robotium.org
Apache License 2.0
2.86k stars 786 forks source link

Android N, the method Solo#getView(int) returns a view on a previous activity #856

Open LuisAndroidDev opened 8 years ago

LuisAndroidDev commented 8 years ago

With Android N, the method Solo#getView(int) returns a view on a previous activity (rather than a view on the current activity) when a previous activity in the stack has a view with the same id.

After debugging and analyzing the code, it seems that this happens because Android N uses a new DecorView class and the method ViewFetcher#isDecorView(view) does not recognize it.

Tested in Robotium 5.5.4 and 5.6.3

Thanks

renas commented 8 years ago

What happens if you use index? e.g. getView(R.id.x, 1)

LuisAndroidDev commented 8 years ago

Hi Renas. Thanks for the reply.

Using a index the method can return the view in the current activity .