"Error: no such session" Webdriver-IO, Appium

"Error: no such session" Webdriver-IO, Appium

我已经设置了 Cucumber、Webdriver-IO 和 Appium。一切似乎都在互相交谈,但是我在尝试导航到 http://google.com.

时得到 Error: no such session

在 Android 设备上它打开 Chrome 浏览器,然后非常快速地关闭它。

webdriverio.js

//webdriverio.js
let client = WebDriverIO.remote({
    desiredCapabilities: {
        platformName: 'Android',                        
      browserName: 'chrome',                          
      deviceName: 'test',
    },
    host: 'localhost',                                  
    port: 4723,                                     
    waitForTimeout: 120 * 1000,
});

global.client = client;

module.exports = function() {
  this.registerHandler('BeforeFeatures', function(event, done) {
    client.init().call(done);
  });

  this.registerHandler('AfterFeatures', function(event, done) {
    client.end().call(done);
  });
};

env.js

// env.js
module.exports = function() {
  // added because default 50000 ms was long enough
  this.setDefaultTimeout(60 * 1000);
};

search_steps.js

// search_steps.js
module.exports = function() {
  this.Given('I have visited Google', function (done) {
    client
      .url('http://google.com')
      .call(done);
  });

    this.When('I search for {arg1:stringInDoubleQuotes}', function (arg1, done) {
     // Write code here that turns the phrase above into concrete actions
     client
        .setValue('input[name="q"]', 'Kittens')
        .call(done);
    });


    this.Then('I see {arg1:stringInDoubleQuotes}', function (arg1, done) {
         // Write code here that turns the phrase above into concrete actions
         client
            .getValue('input[name="q"]').then(function(text){
                expect('Kittens').to.eql(text);
            })
            .call(done);
    });


};

问题是我的 Mac 版本的 Appium (1.3.5) 随附的 chromedriver 2.21.371459。我下载了最新版本的 chromedriver 并覆盖了 Appium 附带的现有版本。请在此处查看 对 windows 的回答。对于 mac Appium 附带的 chromedriver exec 的位置是。 /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver/chromedriver/mac