How to stop automatically closing browser when writing protractor test cases

后端 未结 9 1777
面向向阳花
面向向阳花 2021-02-07 12:43

I am new to writing test cases using protractor for non angular application. I wrote a sample test case.Here the browser closes automatically after running test case.How can I p

9条回答
  •  渐次进展
    2021-02-07 12:56

    Add a callback function in It block and the browser window doesn't close until you call it. So perform the action that you need and place the callback at your convenience

    var submitBtnElm = $('input[data-behavior=saveContribution]');
      it('Should Search', function(callback) {
        browser.driver.get('http://localhost/enrollments/osda1.html');   
        browser.driver.findElement(by.id('contributePercentValue')).sendKeys(50);
        submitBtnElm.click().then(function() {
           // Have all the logic you need
           // Then invoke callback
           callback();
        });
      });
    

提交回复
热议问题