Protractor: open window and test URL

I am trying to check a link in a table that opens a new window. I want to check the url of a new window.

What I still know:

it('Should verify new window url', function () { page.list.get(0).click().then(function () { browser.getAllWindowHandles().then(function (handles) { newWindowHandle = handles[1]; browser.switchTo().window(newWindowHandle).then(function () { expect(browser.getCurrentUrl()).toMatch(/\/url/); }); }); }); }); 

Error: Error while waiting for Protractor to synchronize with the page: {}

It works if I remove the wait .... I'm confused about promises, can anyone direct me in the right direction?

+6
source share
1 answer

It turns out that this new page does not have angular, so I had to use the base driver.

 expect(browser.driver.getCurrentUrl()).toMatch(/\/url/); 
+10
source

All Articles