Bug 1354323 - Accept string text for sendKeysToDialog command; r=automatedtester
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 06 Apr 2017 23:37:04 +0100
changeset 351765 2e8560b4346891c3671e47f24675cfb1aacae6bb
parent 351764 8b14e682ecb7f45e29376ccaad8a8e19f4d230ce
child 351766 bfbe4eb625ef29446b70c558c6509d1f6af8c4ce
push id40296
push useratolfsen@mozilla.com
push dateFri, 07 Apr 2017 13:06:15 +0000
treeherderautoland@2e8560b43468 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester
bugs1354323
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1354323 - Accept string text for sendKeysToDialog command; r=automatedtester As a follow-up to https://bugzilla.mozilla.org/show_bug.cgi?id=1354323, this makes the Marionette sendKeysToDialog command take a text field with a string, instead of the value field with an array of strings. The relevant WebDriver specification change is https://github.com/w3c/webdriver/pull/889. Fixes: https://github.com/mozilla/geckodriver/issues/607 MozReview-Commit-ID: AY52pAK2582
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/driver.js
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -535,17 +535,17 @@ class Alert(object):
     @property
     def text(self):
         """Return the currently displayed text in a tab modal."""
         return self.marionette._send_message("getTextFromDialog", key="value")
 
     def send_keys(self, *string):
         """Send keys to the currently displayed text input area in an open
         tab modal dialog."""
-        body = {"value": Marionette.convert_keys(*string)}
+        body = {"text": Marionette.convert_keys(*string)}
         self.marionette._send_message("sendKeysToDialog", body)
 
 
 class Marionette(object):
     """Represents a Marionette connection to a browser or device."""
 
     CONTEXT_CHROME = "chrome"  # non-browser content: windows, dialogs, etc.
     CONTEXT_CONTENT = "content"  # browser content: iframes, divs, etc.
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -2643,34 +2643,47 @@ GeckoDriver.prototype.getTextFromDialog 
   assert.window(this.getCurrentWindow());
   this._checkIfAlertIsPresent();
 
   let {infoBody} = this.dialog.ui;
   resp.body.value = infoBody.textContent;
 };
 
 /**
+ * Set the user prompt's value field.
+ *
  * Sends keys to the input field of a currently displayed modal, or
  * returns a no such alert error if no modal is currently displayed. If
  * a tab modal is currently displayed but has no means for text input,
  * an element not visible error is returned.
+ *
+ * @param {string} text
+ *     Input to the user prompt's value field.
+ *
+ * @throws {ElementNotInteractableError}
+ *     If the current user prompt is an alert or confirm.
+ * @throws {NoSuchAlertError}
+ *     If there is no current user prompt.
+ * @throws {UnsupportedOperationError}
+ *     If the current user prompt is something other than an alert,
+ *     confirm, or a prompt.
  */
 GeckoDriver.prototype.sendKeysToDialog = function (cmd, resp) {
   let win = assert.window(this.getCurrentWindow());
   this._checkIfAlertIsPresent();
 
   // see toolkit/components/prompts/content/commonDialog.js
   let {loginContainer, loginTextbox} = this.dialog.ui;
   if (loginContainer.hidden) {
     throw new ElementNotInteractableError(
         "This prompt does not accept text input");
   }
 
   event.sendKeysToElement(
-      cmd.parameters.value,
+      cmd.parameters.text,
       loginTextbox,
       {ignoreVisibility: true},
       this.dialog.window ? this.dialog.window : win);
 };
 
 GeckoDriver.prototype._checkIfAlertIsPresent = function () {
   if (!this.dialog || !this.dialog.ui) {
     throw new NoAlertOpenError("No modal dialog is currently open");