代码之家  ›  专栏  ›  技术社区  ›  soccerway

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

  •  0
  • soccerway  · 技术社区  · 5 年前

    如何关闭 print window 在单击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(); 
    }
    
    0 回复  |  直到 5 年前