Closed Bug 860042 Opened 11 years ago Closed 10 years ago

.text doesn't get the title's text in desktop b2g

Categories

(Remote Protocol :: Marionette, defect)

x86
Other
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: mdas, Unassigned)

Details

Calling .text on a title dom element doesn't return expected values on desktop B2G in the Browser app.

This test: https://github.com/mozilla/gaia-ui-tests/blob/master/gaiatest/tests/browser/test_browser_search.py#L33 fails on line 33 because .text returns an empty string instead of the expected title. The funny thing is, this passes on the phone, just not on desktop B2G.

FYI, if you change line 33 to .get_attribute("innerHTML"), then it passes on both desktop B2G and phone.

Passes on the phone:
http://qa-selenium.mv.mozilla.com:8080/view/B2G/job/b2g.unagi.gaia.nightly.ui/175/console

Fails on desktop b2g with:

======================================================================
FAIL: test_browser_search (test_browser_search.TestBrowserSearch)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mdas/code/gaia-ui-tests/gaiatest/tests/browser/test_browser_search.py", line 35, in test_browser_search
    self.marionette.find_element(*self._title_locator).text)
TEST-UNEXPECTED-FAIL | test_browser_search.py TestBrowserSearch.test_browser_search | AssertionError: 'Bing : Mozilla Web QA' != u''
----------------------------------------------------------------------
Ran 1 test in 5.273s
I can confirm that this isn't a timing issue either. I've added 5 second sleeps before line 32, and still fails.
I think we should be using marionette.title here...
(In reply to Dave Hunt (:davehunt) from comment #2)
> I think we should be using marionette.title here...

agreed, but this highlights that .text doesn't seem to be doing what we want. 

https://github.com/mozilla/gaia-ui-tests/blob/c274a4b2b94085f38c85106f4c62a9717a7116a2/gaiatest/tests/browser/test_browser_search.py#L33 is a link to the line in question, since we're going to replace this with marionette.title in the future.
I've submitted a pull request to fix the test: https://github.com/mozilla/gaia-ui-tests/pull/638
This sounds like an is_displayed() error.
No longer blocks: 857622
getElementText on a <title> element will return u'' since the element, while it shows in desktop browsers title bar, isnt actually a visible element so this is working as intended.

as mentioned by :davehunt in comment #2 we should use marionette.title or we can use JavaScript to get the value
Closing this since marionette.title or execute_script can handle this situation. THe current implementation follows Webdriver (spec prose still to be written)
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.