1

I am trying to check the url of a new pop-up window, and this window is from a non-Angular application. I tried the code I found from the issue board of Protractor in Github. But there is an error:

Message:
   UnknownError: null value in entry: name=null
Stacktrace:
   UnknownError: null value in entry: name=null

This is my script:

var handlePromise;
browser.ignoreSynchronization = true;
var landingPage=require("../page-objects/landing_page.js");
var ptor = protractor.getInstance();

describe('iso1 -', function() {
    landingPage.visitISO1();
    it('Administration should not be on the menu"', function() {
        expect(element(by.xpath('//*[@id="menu"]/ul[1]/li[3]/a')).isDisplayed()).toBe(true);   
        element(by.xpath('//*[@id="menu"]/ul[1]/li[3]/a')).click();  

        handlePromise = browser.driver.getAllWindowHandles();
            var handles = handlePromise.then(function (handles) {
//                parentHandle = handles[0];
                popUpHandle = handles[1];
                handle = browser.switchTo().window(popUpHandle);
//                ptor.sleep(1000);
                handle = browser.getWindowHandle();
                expect(handle).toEqual(popUpHandle);
//              browser.driver.executeScript('window.focus();');

                var expectedUrl = browser.driver.getCurrentUrl();
                expect(expectedUrl).toEqual('https://XXXXXXXXXXXXXXXXXXXXXXXXXXXX');
            });
        landingPage.menu.home();
    });
});

Many thanks in advance.

jasonnjit
  • 41
  • 3
  • 4
  • What does `landingPage.visitISO1();` do? Generally, it's not a good idea to run code outside of a `beforeEach` or `it` block in Jasmine, as the order when it's run is probably not what you want. I wonder if this is setting up your page incorrectly. – Jmr Oct 08 '14 at 22:12
  • 1
    http://stackoverflow.com/questions/30012157/cant-switch-windows-during-testing-by-webdriver-js?lq=1 explained in detail for switching between the windows. – sat_yug Aug 27 '15 at 10:26
  • 1
    for reference https://github.com/angular/protractor/issues/55 – Gordon Sep 13 '18 at 09:51

0 Answers0