switch_to_window() should provide an option not to select the underlying tab automatically



4 years ago
2 years ago


(Reporter: whimboo, Unassigned)


({pi-marionette-client, pi-marionette-server})

Dependency tree / graph

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [needs patch on bug 1124604])

As what I have seen today is that when switch_to_window() is called, the target tab is automatically selected. This will make it impossible for us to do checks for background tabs. As Chris mentioned this behavior was added with the patch on one of his bugs.

Here a small code example which demonstrates that in Firefox:

    def test_switch_to_window(self):
        def selected_index(toolbar):
            return int(toolbar.get_attribute('selectedIndex'))

        org_handle = self.marionette.current_window_handle

        toolbar = self.marionette.find_element('id', 'tabbrowser-tabs')
        button = toolbar.find_element('anon attribute', {'anonid': 'tabs-newtab-button'})

        self.assertEqual(len(self.marionette.window_handles), 2)
        self.assertEqual(selected_index(toolbar), 1)

        self.assertEqual(selected_index(toolbar), 1)
I added this with the patch in bug 941749 because it would seem a convenience, but I see how it would be an unacceptable limitation for firefox-ui-tests. It's easy enough to remove, but we might have to add a parameter for this behavior if other users depend on the switching behavior.
So that would be exactly the request I made via bug 1124604, but which has been wontfixed by David. As it looks like it would still be useful here. I think that it is a good reason to reopen bug 1124604, and marking this bug as dependency on it.
Depends on: 1124604
Summary: switch_to_window() should not select the underlying tab automatically → switch_to_window() should provide an option not to select the underlying tab automatically
Whiteboard: [needs patch on bug 1124604]
Comment hidden (obsolete)
Comment hidden (obsolete)
Those two latest comments are not related to this bug which is about window/tab handling in the Marionette framework. Titus, if you have issues with Firefox then please file a bug in the Firefox General component.

Comment 6

3 years ago
Henrik, Firefox 45 supports Marionette. The gist I linked to clearly has Marionette debug info in it. I believe the issue I'm seeing is related to how tabs are selected. If it is not, I can create a new issue, but it is causing a number of the Ruby Selenium specs to fail.
This bug is specifically to Marionette and switching between tabs and not windows! Please read comment 0. Here in short... switching to a tab should offer a parameter to not automatically focus the target tab.
Looks like a dupe of bug 1124604 now which I just got fixed.
Closed: 2 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1124604
You need to log in before you can comment on or make changes to this bug.