From 54ea5150850168d591c4a7f5c07a613c05db596e Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Fri, 7 Apr 2017 14:28:59 +0100 Subject: [PATCH] geckodriver: marionette: send text string and value array for SendKeysParameters Following https://bugzilla.mozilla.org/show_bug.cgi?id=1348782 and https://bugzilla.mozilla.org/show_bug.cgi?id=1354323, the sendKeysToElement and sendKeysToDialog commands in Marionette accept only a string `text' field as input. These patches to Firefox has since been uplifted all the way to Firefox 53. In order to make geckodriver work with newer Firefox versions again, we need to pass the `text' field. But in order to support older Firefoxen without the `text' field requirement, we also want to continue to send `value' as a string array. Clients must unfortunately send a string `text' field, but it is believed it is easier to upgrade to the latest Selenium release than to pin the exact versions of geckodriver and Firefox. Fixes: https://github.com/mozilla/geckodriver/issues/594 Source-Repo: https://github.com/mozilla/geckodriver Source-Revision: 41f89d878c805e0d66a15f8b6151dda78173ccff committer: jgraham --HG-- extra : rebase_source : 1574a632e591dc121cba77fc58c8026435fbef2b --- testing/geckodriver/src/marionette.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/testing/geckodriver/src/marionette.rs b/testing/geckodriver/src/marionette.rs index 5a61b4d5461d..b8737e72d500 100644 --- a/testing/geckodriver/src/marionette.rs +++ b/testing/geckodriver/src/marionette.rs @@ -914,7 +914,13 @@ impl MarionetteCommand { ElementSendKeys(ref e, ref x) => { let mut data = BTreeMap::new(); data.insert("id".to_string(), e.id.to_json()); - data.insert("value".to_string(), x.text.to_json()); + data.insert("text".to_string(), x.text.to_json()); + data.insert("value".to_string(), + x.text + .chars() + .map(|x| x.to_string()) + .collect::>() + .to_json()); (Some("sendKeysToElement"), Some(Ok(data))) }, ExecuteScript(ref x) => (Some("executeScript"), Some(x.to_marionette())), @@ -932,7 +938,13 @@ impl MarionetteCommand { GetAlertText => (Some("getTextFromDialog"), None), SendAlertText(ref x) => { let mut data = BTreeMap::new(); - data.insert("value".to_string(), x.text.to_json()); + data.insert("text".to_string(), x.text.to_json()); + data.insert("value".to_string(), + x.text + .chars() + .map(|x| x.to_string()) + .collect::>() + .to_json()); (Some("sendKeysToDialog"), Some(Ok(data))) }, TakeScreenshot => {