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

--HG--
extra : rebase_source : f767ae09e5f415e6e944ececfb83c442f23407f3
This commit is contained in:
Andreas Tolfsen 2017-04-06 23:37:04 +01:00
Родитель 9a679079d7
Коммит ab9085d475
2 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -540,7 +540,7 @@ class Alert(object):
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)

Просмотреть файл

@ -2648,10 +2648,23 @@ GeckoDriver.prototype.getTextFromDialog = function (cmd, resp) {
};
/**
* 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());
@ -2665,7 +2678,7 @@ GeckoDriver.prototype.sendKeysToDialog = function (cmd, resp) {
}
event.sendKeysToElement(
cmd.parameters.value,
cmd.parameters.text,
loginTextbox,
{ignoreVisibility: true},
this.dialog.window ? this.dialog.window : win);