javascript - Protractor: How to test window.print() -


i'm trying test print functionality of button, like:

it('print document', function(){     element(by.id('print-button')).click();     expect(window.print()); }); 

i want test browser print dialog box. how this?

browser's print dialog out of scope of selenium, it not under selenium's control. there no way solve problem reliably protractor/selenium only.

besides, don't need test browser , it's ability open print dialogs. can (not tested), test whether window.print called on print-button click redefining window.print() (reference):

browser.setscripttimeout(10);  var printbutton = element(by.id('print-button'));  var result = browser.executeasyncscript(function (elm, callback) {     function listener() {         callback(true);     }      window.print = listener;     elm.click(); }, printbutton.getwebelement());  expect(result).tobe(true); 

see also:


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -