我想用无头浏览器引擎做一些 UI 测试。由于我们的 Linux 中没有图形单元,因此我使用 docker for chrome
我设置了一个测试:
const chai = require('chai');
const expect = chai.expect;
const chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);
const webdriverio = require('webdriverio');
const options = { desiredCapabilities: { browserName: 'chrome' } };
const browser = webdriverio
.remote({ host: 'localhost', port: 4444 })
.init({ browserName: 'chrome', version: '45' });
describe('webdriver.io tests', function() {
it('is a third test', function() {
browser.url('foo');
expect(Promise.resolve(browser.getTitle()))
.to.eventually.equal('foo');
});
测试由:
BABEL_ENV=dev npm run mocha-test --recursive=tests/mocha --compilers js:babel-register --require babel-polyfill
但我得到的只是:
Error: A session id is required for this command but wasn't found in the response payload.
谁能帮我?