Element.displayed? still picking up non-visible items

Hey there:
I know there may be a lot of posts already on this topic. For example, I was trying to follow the github below (even though that speaks to iOS and i’m on Android). Not sure if there is something i’m missing.

I’ve attached a screen shot.
I basically want to script out “Click the back arrow until you don’t see it anymore”.

I have something like this:

@previous_term_arrow = {id: "com.blackboard.android.bbstudent:id/sibling_header_left_arrow"}

And a method like this:

def click_to_oldest_term()
         while (find_element(@previous_term_arrow).displayed? )
          wait {find_element(@previous_term_arrow).click }

The issue is that it gets caught in the loop. It appears it shows my back arrow as displayed even when it’s not visible onscreen. Using the inspector, I see that visible=false, but enabled=true.

Not sure again if it’s a bug (i can file it github with logs) or a misunderstanding on my part. I’ve even tried copying these commands in arc and I get the same result.

Thanks in advance for anyone that can assist. Let me know if you need more information.

If an element is .displayed? then that method call should return true. If it’s true and the element isn’t displayed then I consider that a bug. I think it’d be worth filing an issue so one of the devs can investigate. We’ve had issues in the past with element visibility on iOS.

My guess though is uiautomation thinks the element is visible and so there’s not much appium can do other than report the value as provided by the underlying framework.

Thanks boostraponline!
I’ve just filed: Android: Element.displayed? still picking up non-visible items · Issue #4404 · appium/appium · GitHub
For what it’s worth this is happening on my android samsung galaxy s4 4.4