diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py b/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py index 8036b4694881..d0faadbe15da 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py @@ -116,17 +116,17 @@ class BaseNavigationTestCase(WindowManagerMixin, MarionetteTestCase): class TestNavigate(BaseNavigationTestCase): def test_set_location_through_execute_script(self): - test_element_locator = (By.ID, "testh1") + # To avoid unexpected remoteness changes and a hang in any non-navigation + # command (bug 1519354) when navigating via the location bar, already + # pre-load a page which causes a remoteness change. + self.marionette.navigate(self.test_page_push_state) self.marionette.execute_script( "window.location.href = arguments[0];", script_args=(self.test_page_remote,), sandbox=None) - # We cannot use get_url() to wait until the target page has been loaded, - # because it will return the URL of the top browsing context and doesn't - # wait for the page load to be complete. Wait(self.marionette, timeout=self.marionette.timeout.page_load).until( - expected.element_present(*test_element_locator), + expected.element_present(*(By.ID, "testh1")), message="Target element 'testh1' has not been found") self.assertEqual(self.test_page_remote, self.marionette.get_url())