Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/406.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用javascript函数关闭cypress中打开的打印窗口_Javascript_Cypress - Fatal编程技术网

如何使用javascript函数关闭cypress中打开的打印窗口

如何使用javascript函数关闭cypress中打开的打印窗口,javascript,cypress,Javascript,Cypress,单击cypress中的打印按钮时,如何关闭打开的打印窗口。我正在调用一个js函数来关闭窗口,但它没有执行关闭操作,是否有人可以建议如何解决此问题 context('Print button tests', () => { it.only('Verify the display of Print and close the window', () => { cy.get('.timetable-filter-panel-button.btn.btn-primary >

单击cypress中的打印按钮时,如何关闭打开的
打印窗口。我正在调用一个
js
函数来关闭窗口,但它没有执行关闭操作,是否有人可以建议如何解决此问题

context('Print button tests', () => {
  it.only('Verify the display of Print and close the window', () => {
    cy.get('.timetable-filter-panel-button.btn.btn-primary > span')
      .contains("Print current view")
      .click();
    printClose();    
  })
})
//关闭打开窗口的Javascript函数:

function printClose(){
    window.close(); 
}

@bkucera你能帮我解决上面的问题吗?好吧,你不能,就像你不能对它进行操作一样,唯一的解决方案似乎是这样的。但是我看到了这个解决方案,我想在打开后关闭打印对话框。@soccerway也许我有点晚了,但我得到了同样的问题&我用下面发布的代码片段解决了。我希望有帮助@bkucera你能帮我解决上面的问题吗?好吧,你不能,就像你不能对它进行操作一样,唯一的解决方案似乎是这样的。但是我看到了这个解决方案,我想在打开后关闭打印对话框。@soccerway也许我有点晚了,但我得到了同样的问题&我用下面发布的代码片段解决了。我希望有帮助!