how to close selenium webdriver at end of test?

我与影子孤独终老i 提交于 2019-12-11 10:27:00

问题


I have created a e2e test for my angular app. I would like to close down the selenium webdriver at the end of the test:

describe('Selenium end', function () {
    it("close down selenium server", function () {
        browser.get('http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer');
        var text = element(by.css('pre')).getText(function (text) {
            expect(text).toEqual('OKOK');
        });
    });
});

When I run this i get:

 Message:     Error: Error while running testForAngular: ECONNREFUSED connect ECONNREFUSED

How can I stop the selenium webdriver or assert it is closed based on the info above?


回答1:


Protractor can start up and shut down a selenium server for you, if you use the seleniumServerJar and seleniumPort fields in the configuration file. See https://github.com/angular/protractor/blob/master/docs/referenceConf.js#L23



来源:https://stackoverflow.com/questions/27007661/how-to-close-selenium-webdriver-at-end-of-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!