{"action":"opened","issue":{"url":"https://api.github.com/repos/angular/protractor/issues/2306","labels_url":"https://api.github.com/repos/angular/protractor/issues/2306/labels{/name}","comments_url":"https://api.github.com/repos/angular/protractor/issues/2306/comments","events_url":"https://api.github.com/repos/angular/protractor/issues/2306/events","html_url":"https://github.com/angular/protractor/issues/2306","id":93324431,"number":2306,"title":"Should browser.navigate() use waitForAngular() before it fires?","user":{"login":"martin770","id":13204495,"avatar_url":"https://avatars.githubusercontent.com/u/13204495?v=3","gravatar_id":"","url":"https://api.github.com/users/martin770","html_url":"https://github.com/martin770","followers_url":"https://api.github.com/users/martin770/followers","following_url":"https://api.github.com/users/martin770/following{/other_user}","gists_url":"https://api.github.com/users/martin770/gists{/gist_id}","starred_url":"https://api.github.com/users/martin770/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martin770/subscriptions","organizations_url":"https://api.github.com/users/martin770/orgs","repos_url":"https://api.github.com/users/martin770/repos","events_url":"https://api.github.com/users/martin770/events{/privacy}","received_events_url":"https://api.github.com/users/martin770/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-06T16:45:36Z","updated_at":"2015-07-06T16:45:36Z","closed_at":null,"body":"We have a search engine type of application, and in our test we want to perform a search then go back to the previous page and verify some stuff:\r\n\r\n    element(searchButton).click();\r\n    browser.navigate.back();\r\n    expect(searchButton.isPresent()).toBe(true);\r\n\r\nSometimes the clicking of the search button takes a bit of time to load the results page, but the browser is more than happy to fire off the back button immediately, in which case the expectation fails.\r\n\r\nMy workaround seems to be:\r\n\r\n    element(searchButton).click();\r\n    browser.waitForAngular(); // make sure we get the results page loaded before clicking Back\r\n    browser.navigate.back();\r\n    expect(searchButton.isPresent()).toBe(true);\r\n\r\nOr I suppose I could:\r\n\r\n    element(searchButton).click();\r\n    expect(resultsPage.isPresent()).toBe(true); // unnecessary verification to force page load\r\n    browser.navigate.back();\r\n    expect(searchButton.isPresent()).toBe(true);\r\n\r\n\r\nPlease correct me if I'm wrong but my understanding is that any time protractor is performing an action on an element, it will wait for angular before performing that action, but not wait after the action. Because the browser.navigate() things are not actions on an element, I don't think it knows to wait before performing those actions. If that is the case, could the browser.navigate() things be patched to automatically waitForAngular() ?\r\n\r\nOf course, the examples above are pseudo-code, so if the message is not clear enough I can try to provide other examples. And yes, the pages I am referring to are angular ;) Thanks!"}}