native ui elements is_displayed incorrectly returns False

RESOLVED INVALID

Status

Testing
Marionette
--
blocker
RESOLVED INVALID
5 years ago
5 years ago

People

(Reporter: edwong, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
my phone setup:
Gecko  http://hg.mozilla.org/releases/mozilla-b2g18_v1_0_1/rev/047b7010c99a
Gaia   09299399500b50de72cdd3b4365fc6455bbbb145
BuildID 20130523070210
Version 18.0

1. make sure your computer can run marionette on your phone
2. run this in shell
python

from marionette import Marionette
from gaiatest.apps.browser.app import Browser
m = Marionette('localhost', 2828)
m.start_session()
browser = Browser(m)
browser.launch()
browser.go_to_url('http://native.123done.org\n')
browser.switch_to_content()

#wait till stuff is fully loaded
btn = m.find_element('css selector', 'img[src*="persona-login"]')
btn.tap(btn)

m.switch_to_frame()
n_ui = m.find_element('css selector', 'iframe[src*="firefoxos"]')
m.switch_to_frame(n_ui)
pp = m.find_element('link text', 'Privacy Policy')
pp.is_displayed()

# returns False, but it's I can see it on the phone
# I can't click on it or other controls, most everything is is_displayed = False
(Reporter)

Updated

5 years ago
Blocks: 865232

Comment 1

5 years ago
Edwin, we have a very similar test case already in gaia-ui-tests which you should be able to compare to see where you are going wrong.

https://github.com/mozilla/gaia-ui-tests/blob/master/gaiatest/tests/persona/test_persona_cookie.py

Can you check whether you are in the correct iframe after switching into the frame (line 16)? You can do this by printing self.marionette.current_url

I'm concerned you're goign into the wrong frame because if I recall there's a temporary communication iframe in there and your frame locator might be matching both of them.
If you change it to this locator:
https://github.com/mozilla/gaia-ui-tests/blob/master/gaiatest/apps/persona/app.py#L12
what do you get?
(Reporter)

Comment 2

5 years ago
I can give current_url a try but I've been printing page_source and I can see the exact controls I'm targeting in the src.

Comment 3

5 years ago
Now that I look at this again I think it might be timing. I'll run it myself soon but I'd be tempted to put a few sleep(10) in there to make sure the javascript has completed. Especially in Persona there is loads of javascript and it's remotely hosted so it has to come over the internet. It takes quite a while to get going.

Comment 4

5 years ago
Sorry I've run out of time but if you spray it with sleeps and be sure you're in the correct iframe there should be no problem as we already run the equivalent of this test on that build you're using.
(Reporter)

Comment 5

5 years ago
it looks like I might have been targeting the wrong element on page, since there are multiple instances with same class/text.  I'll close the bug once I can get my test working.  Thanks for looking into it.
(Reporter)

Comment 6

5 years ago
yup, if i just did len on find_elements() -- closing
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.