зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1274924 - GeckoDriver.getTextFromDialog() throws "TypeError: can't convert null to object" r=automatedtester
MozReview-Commit-ID: G5p7gKjMYr7 --HG-- extra : rebase_source : 5784d1303e3f0df0177d6a03ccfae6a1e6936b2f
This commit is contained in:
Родитель
fc05053829
Коммит
47a1d0c413
|
@ -2475,10 +2475,7 @@ GeckoDriver.prototype.maximizeWindow = function(cmd, resp) {
|
|||
* no modal is displayed.
|
||||
*/
|
||||
GeckoDriver.prototype.dismissDialog = function(cmd, resp) {
|
||||
if (!this.dialog) {
|
||||
throw new NoAlertOpenError(
|
||||
"No tab modal was open when attempting to dismiss the dialog");
|
||||
}
|
||||
this._checkIfAlertIsPresent();
|
||||
|
||||
let {button0, button1} = this.dialog.ui;
|
||||
(button1 ? button1 : button0).click();
|
||||
|
@ -2490,10 +2487,7 @@ GeckoDriver.prototype.dismissDialog = function(cmd, resp) {
|
|||
* no modal is displayed.
|
||||
*/
|
||||
GeckoDriver.prototype.acceptDialog = function(cmd, resp) {
|
||||
if (!this.dialog) {
|
||||
throw new NoAlertOpenError(
|
||||
"No tab modal was open when attempting to accept the dialog");
|
||||
}
|
||||
this._checkIfAlertIsPresent();
|
||||
|
||||
let {button0} = this.dialog.ui;
|
||||
button0.click();
|
||||
|
@ -2505,10 +2499,7 @@ GeckoDriver.prototype.acceptDialog = function(cmd, resp) {
|
|||
* alert error if no modal is currently displayed.
|
||||
*/
|
||||
GeckoDriver.prototype.getTextFromDialog = function(cmd, resp) {
|
||||
if (!this.dialog) {
|
||||
throw new NoAlertOpenError(
|
||||
"No tab modal was open when attempting to get the dialog text");
|
||||
}
|
||||
this._checkIfAlertIsPresent();
|
||||
|
||||
let {infoBody} = this.dialog.ui;
|
||||
resp.body.value = infoBody.textContent;
|
||||
|
@ -2521,10 +2512,7 @@ GeckoDriver.prototype.getTextFromDialog = function(cmd, resp) {
|
|||
* an element not visible error is returned.
|
||||
*/
|
||||
GeckoDriver.prototype.sendKeysToDialog = function(cmd, resp) {
|
||||
if (!this.dialog) {
|
||||
throw new NoAlertOpenError(
|
||||
"No tab modal was open when attempting to send keys to a dialog");
|
||||
}
|
||||
this._checkIfAlertIsPresent();
|
||||
|
||||
// see toolkit/components/prompts/content/commonDialog.js
|
||||
let {loginContainer, loginTextbox} = this.dialog.ui;
|
||||
|
@ -2540,6 +2528,13 @@ GeckoDriver.prototype.sendKeysToDialog = function(cmd, resp) {
|
|||
win);
|
||||
};
|
||||
|
||||
GeckoDriver.prototype._checkIfAlertIsPresent = function() {
|
||||
if (!this.dialog || !this.dialog.ui) {
|
||||
throw new NoAlertOpenError(
|
||||
"No tab modal was open when attempting to get the dialog text");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Quits Firefox with the provided flags and tears down the current
|
||||
* session.
|
||||
|
|
Загрузка…
Ссылка в новой задаче