I have been struggling with these lines of Protractor code today:
element(by.linkText(\"People\")).click();
browser.waitForAngular();
var url = brows
Instead of waitForAngular() call, wait for the URL to change:
browser.wait(function() {
return browser.getCurrentUrl().then(function(url) {
return /index/.test(url);
});
}, 10000, "URL hasn't changed");
Originally suggested by @juliemr at UnknownError: javascript error: document unloaded while waiting for result.
This piece of code works correctly
var handlePromise = browser.driver.getAllWindowHandles();
handlePromise.then(function (handles) {
// parentHandle = handles[0];
var popUpHandle = handles[1];
// Change to new handle
browser.driver.switchTo().window(popUpHandle).then(function() {
return browser.getCurrentUrl().then(function(url) {
console.log("URL= "+ url);
});
})
});