Closed Bug 814125 Opened 12 years ago Closed 6 years ago

Error messages during switch_to_frame should be more friendly especially in chrome space

Categories

(Remote Protocol :: Marionette, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: automatedtester, Unassigned)

References

Details

While Ted was using marionette the following errors where happening when switching frames and we need to do a better job of handling it


luser@eye7:/build$ ~/B2G/objdir-gecko/_virtualenv/bin/python
Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from marionette import Marionette
>>> marionette = Marionette(host='localhost', port=2828)
>>> marionette.start_session()
u'6-b2g'
>>> marionette.set_script_timeout(6000)
True
>>> marionette.set_context(marionette.CONTEXT_CHROME)
True
>>> marionette.execute_script("navigator.mozSettings.createLock().set({'lockscreen.enabled': false});")
>>> 
>>> marionette.switch_to_frame(0)
True
>>> marionette.import_script("/build/launchapp.js")
True
>>> res = marionette.execute_async_script("launch_app('%s')" % origin)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'origin' is not defined
>>> origin = "app://clock.gaiamobile.org"
>>> res = marionette.execute_async_script("launch_app('%s')" % origin)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 458, in execute_async_script
    specialPowers=special_powers)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 211, in _send_message
    self._handle_error(response)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 260, in _handle_error
    raise ScriptTimeoutException(message=message, status=status, stacktrace=stacktrace)
marionette.errors.ScriptTimeoutException: timed out
>>> marionette.import_script("/build/launchapp.js")
True
>>> res = marionette.execute_async_script("launch_app('%s')" % origin)
>>> res
{u'time_to_paint': 3616.467563999817, u'frame': u'appframe7'}
>>> marionette.switch_to_frame(res.get['frame'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'builtin_function_or_method' object has no attribute '__getitem__'
>>> res.get
<built-in method get of dict object at 0x1e958d0>
>>> marionette.switch_to_frame(res.get('frame'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 367, in switch_to_frame
    response = self._send_message('switchToFrame', 'ok', value=frame)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 211, in _send_message
    self._handle_error(response)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 269, in _handle_error
    raise MarionetteException(message=response, status=500)
marionette.errors.MarionetteException: {u'message': u"error occurred while processing 'switchToFrame' request: TypeError: frameElement is null", u'from': u'conn10.marionette1', u'error': u'unknownError'}
>>> res.get('frame')
u'appframe7'
>>> marionette.switch_to_frame('appframe7')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 367, in switch_to_frame
    response = self._send_message('switchToFrame', 'ok', value=frame)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 211, in _send_message
    self._handle_error(response)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 269, in _handle_error
    raise MarionetteException(message=response, status=500)
marionette.errors.MarionetteException: {u'message': u"error occurred while processing 'switchToFrame' request: TypeError: frameElement is null", u'from': u'conn10.marionette1', u'error': u'unknownError'}
>>> marionette.execute_script("WindowManager.kill('%s')" % origin)
>>> res = marionette.execute_async_script("launch_app('%s')" % origin)
>>> res
{u'time_to_paint': 2572.0030540004373, u'frame': u'appframe8'}
>>> marionette.switch_to_frame(res.get('frame'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 367, in switch_to_frame
    response = self._send_message('switchToFrame', 'ok', value=frame)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 211, in _send_message
    self._handle_error(response)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 269, in _handle_error
    raise MarionetteException(message=response, status=500)
marionette.errors.MarionetteException: {u'message': u"error occurred while processing 'switchToFrame' request: TypeError: frameElement is null", u'from': u'conn10.marionette1', u'error': u'unknownError'}
>>> res.get('frame')
u'appframe8'
>>> marionette.get_url()
u'app://system.gaiamobile.org/index.html'
>>> marionette.execute_script("return window.frames.length;")
1
>>> marionette.switch_to_frame(0)
True
>>> marionette.get_url()
u'app://keyboard.gaiamobile.org/index.html'
>>> marionette.switch_to_frame(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 367, in switch_to_frame
    response = self._send_message('switchToFrame', 'ok', value=frame)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 211, in _send_message
    self._handle_error(response)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 234, in _handle_error
    raise NoSuchFrameException(message=message, status=status, stacktrace=stacktrace)
marionette.errors.NoSuchFrameException: Unable to locate frame: 0
>>> marionette.get_url()
u'app://keyboard.gaiamobile.org/index.html'
>>> marionette.switch_to_frame()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 367, in switch_to_frame
    response = self._send_message('switchToFrame', 'ok', value=frame)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 211, in _send_message
    self._handle_error(response)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 269, in _handle_error
    raise MarionetteException(message=response, status=500)
marionette.errors.MarionetteException: {u'message': u"error occurred while processing 'switchToFrame' request: TypeError: this.mainFrame is null", u'from': u'conn10.marionette1', u'error': u'unknownError'}
>>> marionette.set_context(marionette.CONTEXT_CHROME)
True
>>> marionette.get_url()
u'chrome://browser/content/shell.xul'
>>> marionette.switch_to_frame(0)
True
>>> marionette.get_url()
u'app://system.gaiamobile.org/index.html'
>>> marionette.switch_to_frame('appid8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 367, in switch_to_frame
    response = self._send_message('switchToFrame', 'ok', value=frame)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 211, in _send_message
    self._handle_error(response)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 269, in _handle_error
    raise MarionetteException(message=response, status=500)
marionette.errors.MarionetteException: {u'message': u"error occurred while processing 'switchToFrame' request: TypeError: frameElement is null", u'from': u'conn10.marionette1', u'error': u'unknownError'}
>>> marionette.execute_script("return window.frames.length;")
1
>>> marionette.set_context(marionette.CONTEXT_CHROME)
True
>>> marionette.switch_to_frame('appid8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 367, in switch_to_frame
    response = self._send_message('switchToFrame', 'ok', value=frame)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 211, in _send_message
    self._handle_error(response)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 269, in _handle_error
    raise MarionetteException(message=response, status=500)
marionette.errors.MarionetteException: {u'message': u"error occurred while processing 'switchToFrame' request: TypeError: frameElement is null", u'from': u'conn10.marionette1', u'error': u'unknownError'}
>>> marionette.execute_script("return window.frames.length;")
1
>>> marionette.switch_to_frame(0)
True
>>> marionette.execute_script("return window.frames.length;")
0
>>> marionette.get_url()
u'app://keyboard.gaiamobile.org/index.html'
>>> marionette.set_context(marionette.CONTEXT_CHROME)
True
>>> marionette.get_url()
u'app://keyboard.gaiamobile.org/index.html'
>>> marionette.get_url()
u'app://keyboard.gaiamobile.org/index.html'
>>> marionette.switch_to_frame()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 367, in switch_to_frame
    response = self._send_message('switchToFrame', 'ok', value=frame)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 211, in _send_message
    self._handle_error(response)
  File "/home/luser/B2G/gecko/testing/marionette/client/marionette/marionette.py", line 269, in _handle_error
    raise MarionetteException(message=response, status=500)
marionette.errors.MarionetteException: {u'message': u"error occurred while processing 'switchToFrame' request: TypeError: this.mainFrame is null", u'from': u'conn10.marionette1', u'error': u'unknownError'}
>>>
We should also make sure we're not letting our state get corrupted when this happens.
The error message is now more friendly.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Resolution: FIXED → WORKSFORME
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.