Webdriver.io crashes with NoSessionIdError

流过昼夜 提交于 2019-11-30 15:05:51

Please check out the docs on the wdio test runner. You don't need to create an instance using init on your own. The wdio test runner takes care on creating and ending the session for you.

Your example covers the standalone WebdriverIO usage (without testrunner). You can find examples which use wdio here.

To clarify that: there are two ways of using WebdriverIO. You can embed it in your test system by yourself (using it as standalone / or as a scrapper). Then you need to take care of things like create and end an instance or run those in parallel. The other way to use WebdriverIO is using its test runner called wdio. The testrunner takes a config file with a bunch of information on your test setup and spawns instances updates job information on Sauce Labs and so on.

Every Webdriver command gets executed asynchronously. You properly called the done callback in afterEach and in your test it test, but forgot to do it in beforeEach:

beforeEach(function(done) {
    client = webdriverio.remote({ desiredCapabilities: {browserName: 'firefox'} });
    client.init(done);
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!