this.compareProductTitles = async function(title) {
await browser.getAllWindowHandles().then(function (handles) {
handles.forEach(function (handle) {
console.log(handle.toString());
browser.switchTo.window(handle);
if (browser.getTitle() == title) {
return true;
}
});
});
Trying to use Protractor with Chrome browser to close a window popup based on its title. Currently, the code only checks the first handle in the list and stops there.
Looking for assistance to address this issue. At the moment, it only compares the title of the first handle.
Failures: 1) Compare products Compare product should display correctly Message: Expected 'MOBILE' to equal 'COMPARE PRODUCTS'. Stack: Error: Failed expectation at UserContext. (E:\Protractor workspace\POM_PROTRACTOR\Testcases\TC_04_CompareProducts.spec.js:17:47) at C:\Users\tailet\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:112:25