javascript - Protractor - switch tabs error -


i'm trying switch tab , use controls on new tab , error:

unknownerror: null value in entry: name=null

this test (the important part):

element(by.repeater("project in projects").row(1).column("{{project.name}}")).click().then(function(){         flow.timeout(5000);        $('.project-data a').click().then(function () {             browser.getallwindowhandles().then(function (handles) {           flow.timeout(5000);              browser.switchto().window(handles[1]).then(function () {             browser.sleep(5000);             browser.ignoresynchronization = true;             }); 

there other part in test it's not relevant since error in part. flow this: after clicking link, tab opened, seems switches new tab - , fails , closes window.

instead of flow.timeout(5000) use browser.wait so:

browser.wait(function() {     return handles.length > 1 }, 5000); 

and instead of second flow.timeout(5000) use:

browser.wait(function() {     return browser.getcurrenturl().then(function (url){         return url = "url of second tab";     }); }, 5000); 

it looks cleaner, better handled, , importantly, job


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -