Closed Bug 1254140 Opened 8 years ago Closed 3 years ago

"MarionetteException: this.curFrame is null" trying to access a remote browser element

Categories

(Remote Protocol :: Marionette, defect, P5)

defect

Tracking

(e10s+)

RESOLVED INVALID
Tracking Status
e10s + ---

People

(Reporter: standard8, Unassigned)

References

(Blocks 2 open bugs)

Details

(Keywords: pi-marionette-server)

Attachments

(1 file)

In bug 1254132, I'm trying to get the functional tests for Loop working in e10s mode. I have got them so far, but now I'm coming up against an issue that appears to be Marionette.

What we are doing:

- We use Marionette in chrome mode to open a conversation window via the Loop panel.
- We then do:

        # Switch to chrome context
        self.marionette.set_context("chrome")
        self.marionette.switch_to_frame()

        # XXX should be using wait_for_element_displayed, but need to wait
        # for Marionette bug 1094246 to be fixed.
        chatbox = self.wait_for_element_exists(By.TAG_NAME, 'chatbox')
        script = ("return document.getAnonymousElementByAttribute("
                  "arguments[0], 'anonid', '" + contentBox + "');")
        frame = self.marionette.execute_script(script, [chatbox])
        self.marionette.switch_to_frame(frame)

This fails the tests on the last line with:

MarionetteException: this.curFrame is null

If I inset a set_context("content") just before the last switch_to_frame, then I get:

NoSuchFrameException: Unable to locate frame: <uuid>


This can be tested out via the code on https://github.com/mozilla/loop/pull/254 :

$ make install
$ make build
$ TEST_E10S=1 TEST_BROWSER=/Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox make functional

Note: Use aurora/dev edition at the moment, since we've a separate issue on nightly that stops them running as far.
I tried this as an alternative, but I still got the this.curFrame is null:

        # XXX should be using wait_for_element_displayed, but need to wait
        # for Marionette bug 1094246 to be fixed.
        chatbox = self.wait_for_element_exists(By.TAG_NAME, 'chatbox')

        frames = chatbox.find_elements("anon", contentBox)
        frame = None
        for frameMatch in frames:
            if frameMatch.get_attribute("anonid") == contentBox:
                frame = frameMatch
                break

        if not frame:
            raise NoSuchElementException("Failed to find chatbox frame")
I also have a much simpler way now:

        chatbox = self.wait_for_element_exists(By.TAG_NAME, 'chatbox')
        frame = chatbox.find_element("anon attribute", {"anonid": contentBox})
        self.marionette.switch_to_frame(frame)

though this still has the same issue.
David, is there someone who could help us out on this? It affects us getting our functional tests up and running in e10s mode.
tracking-e10s: --- → ?
Flags: needinfo?(dburns)
We're using the versions of Marionette listed here: https://github.com/mozilla/loop/blob/8a8ae92c8fceec16cbab2b8b344baca1833a2d68/bin/require.pip

Full stack:

TEST-START | test_1_browser_call.py Test1BrowserCall.test_1_browser_call
node bin/server.js
Static contents are available at http://localhost:3001/
Tests are viewable at http://localhost:3001/test/
Use this for development only.
TEST-UNEXPECTED-ERROR | test_1_browser_call.py Test1BrowserCall.test_1_browser_call | MarionetteException: MarionetteException: this.curFrame is null


Traceback (most recent call last):
  File "/Users/mark/loop/loop/built/.venv/lib/python2.7/site-packages/marionette/marionette_test.py", line 351, in run
    testMethod()
  File "/Users/mark/loop/loop/test/functional/test_1_browser_call.py", line 217, in test_1_browser_call
    self.local_check_room_self_video()
  File "/Users/mark/loop/loop/test/functional/loopTestDriver.py", line 135, in local_check_room_self_video
    self.switch_to_chatbox()
  File "/Users/mark/loop/loop/test/functional/loopTestDriver.py", line 80, in switch_to_chatbox
    self.marionette.switch_to_frame(frame)
  File "/Users/mark/loop/loop/built/.venv/lib/python2.7/site-packages/marionette_driver/marionette.py", line 1424, in switch_to_frame
    self._send_message("switchToFrame", body)
  File "/Users/mark/loop/loop/built/.venv/lib/python2.7/site-packages/marionette_driver/decorators.py", line 36, in _
    return func(*args, **kwargs)
  File "/Users/mark/loop/loop/built/.venv/lib/python2.7/site-packages/marionette_driver/marionette.py", line 757, in _send_message
    self._handle_error(err)
  File "/Users/mark/loop/loop/built/.venv/lib/python2.7/site-packages/marionette_driver/marionette.py", line 818, in _handle_error
    raise errors.lookup(error)(message, stacktrace=stacktrace)
TEST-INFO took 10708ms
Flags: needinfo?(dburns)
This sounds very similar to what I'm getting on bug 1270799
Current theories are that this is because we haven't set the context to "content" before attempting to switch to the chatbox frame (and hence are trying to access the frame in the wrong process).

However, I believe the issue is that Marionette doesn't give us a way to get the chatbox frame as it exists in the "content" context.
This is an example unit test that reproduces the issue.

If the line `browser.setAttribute('frameType', 'social');` is removed, then the error changes to "this.docShell is null".

The frameType is adding a binding of the browser element to remote-browser.xml which is necessary at least for devtools to work properly.

Note: the test doesn't do cleanup, so probably needs a bit more work before it would pass amongst other tests, but it does show the same errors as we're getting.
Priority: -- → P5

As I understand loop doesn't exist anymore. As such closing this bug.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: