diff --git a/android/adb.js b/android/adb.js index dfbf58796..6ef010315 100644 --- a/android/adb.js +++ b/android/adb.js @@ -900,16 +900,16 @@ ADB.prototype.checkForSocketReady = function(output) { this.onSocketReady(null); }, this)); this.socketClient.setEncoding('utf8'); + var oldData = ''; this.socketClient.on('data', _.bind(function(data) { this.debug("Received command result from bootstrap"); try { - data = JSON.parse(data); + data = JSON.parse(oldData + data); + oldData = ''; } catch (e) { - this.debug("Could not parse JSON from data: " + data); - data = { - status: status.codes.UnknownError.code - , value: "Got a bad response from Android server" - }; + logger.info("Stream still not complete, waiting"); + oldData += data; + return; } if (this.cmdCb) { var next = this.cmdCb; diff --git a/test/functional/apidemos/findElement.js b/test/functional/apidemos/findElement.js index fd9cdc6cf..623dc930a 100644 --- a/test/functional/apidemos/findElement.js +++ b/test/functional/apidemos/findElement.js @@ -246,3 +246,12 @@ describeWd('unallowed tag names', function(h) { }); }); }); + +describeWd('mobile xmlKeyContains', function(h) { + it('should not error on xmlKeyContains', function(done) { + h.driver.execute("mobile: xmlKeyContains", [''], function(err, el) { + should.not.exist(err); + done(); + }); + }); +}); \ No newline at end of file