accept text for setValueImmediate and replaceValue as W3C
MODIFY
lib/protocol/routes.js
lib/protocol/routes.js
@@ -555,10 +555,26 @@ const METHOD_MAP = {
POST: {command: 'getStrings', payloadParams: {optional: ['language', 'stringFile']}}
},
'/wd/hub/session/:sessionId/appium/element/:elementId/value': {
- POST: {command: 'setValueImmediate', payloadParams: {required: ['value']}}
+ POST: {command: 'setValueImmediate', payloadParams: {
+ validate: (jsonObj) => (!util.hasValue(jsonObj.value) && !util.hasValue(jsonObj.text)) &&
+ 'we require one of "text" or "value" params',
+ optional: ['value', 'text'],
+ // We want to either a value (old JSONWP) or a text (new W3C) parameter,
+ // but only send one of them to the command (not both).
+ // Prefer 'value' since it's more backward-compatible.
+ makeArgs: (jsonObj) => [jsonObj.value || jsonObj.text],
+ }}
},
'/wd/hub/session/:sessionId/appium/element/:elementId/replace_value': {
- POST: {command: 'replaceValue', payloadParams: {required: ['value']}}
+ POST: {command: 'replaceValue', payloadParams: {
+ validate: (jsonObj) => (!util.hasValue(jsonObj.value) && !util.hasValue(jsonObj.text)) &&
+ 'we require one of "text" or "value" params',
+ optional: ['value', 'text'],
+ // We want to either a value (old JSONWP) or a text (new W3C) parameter,
+ // but only send one of them to the command (not both).
+ // Prefer 'value' since it's more backward-compatible.
+ makeArgs: (jsonObj) => [jsonObj.value || jsonObj.text],
+ }}
},
'/wd/hub/session/:sessionId/appium/settings': {
POST: {command: 'updateSettings', payloadParams: {required: ['settings']}},

MODIFY
test/protocol/routes-specs.js
test/protocol/routes-specs.js
@@ -40,7 +40,7 @@ describe('Protocol', function () {
}
let hash = shasum.digest('hex').substring(0, 8);
// Modify the hash whenever the protocol has intentionally been modified.
- hash.should.equal('14d87e3b');
+ hash.should.equal('009052aa');
});
});

accept text for setValueImmediate and replaceValue as W3C (#347)