Skip to content

Commit

Permalink
geckodriver: marionette: send text string and value array for SendKey…
Browse files Browse the repository at this point in the history
…sParameters

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: mozilla/geckodriver#594
Source-Repo: https://github.com/mozilla/geckodriver
Source-Revision: 41f89d878c805e0d66a15f8b6151dda78173ccff

committer: jgraham <jameshoppipolla.co.uk>

UltraBlame original commit: b443a2f7254b5fcd744a091013c73d697ee0ae29
  • Loading branch information
marco-c committed Oct 1, 2019
1 parent 71dfb79 commit 2583431
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions testing/geckodriver/src/marionette.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<String>>()
.to_json());
(Some("sendKeysToElement"), Some(Ok(data)))
},
ExecuteScript(ref x) => (Some("executeScript"), Some(x.to_marionette())),
Expand All @@ -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::<Vec<String>>()
.to_json());
(Some("sendKeysToDialog"), Some(Ok(data)))
},
TakeScreenshot => {
Expand Down

0 comments on commit 2583431

Please sign in to comment.