Bug 1387644 - Return NoSuchElementError when element is not found r=ato

MozReview-Commit-ID: LDHiyce09GR

--HG--
extra : rebase_source : dff3b50237a3d124c0c41458c0adaf94694f45ef
This commit is contained in:
David Burns 2017-08-05 00:50:46 +01:00
Родитель 3c82b65dc7
Коммит 74b035b657
2 изменённых файлов: 6 добавлений и 5 удалений

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

@ -161,7 +161,7 @@ element.Store = class {
* @returns {nsIDOMElement} * @returns {nsIDOMElement}
* Element associated with reference. * Element associated with reference.
* *
* @throws {JavaScriptError} * @throws {NoSuchElementError}
* If the provided reference is unknown. * If the provided reference is unknown.
* @throws {StaleElementReferenceError} * @throws {StaleElementReferenceError}
* If element has gone stale, indicating it is no longer attached to * If element has gone stale, indicating it is no longer attached to
@ -170,7 +170,8 @@ element.Store = class {
get(uuid, container) { get(uuid, container) {
let el = this.els[uuid]; let el = this.els[uuid];
if (!el) { if (!el) {
throw new JavaScriptError(`Element reference not seen before: ${uuid}`); throw new NoSuchElementError(`Element reference not seen before: ` +
`${uuid}`);
} }
try { try {

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

@ -9,7 +9,7 @@ import struct
import urllib import urllib
from marionette_driver import By from marionette_driver import By
from marionette_driver.errors import JavascriptException, NoSuchWindowException from marionette_driver.errors import NoSuchElementException, NoSuchWindowException
from marionette_harness import ( from marionette_harness import (
MarionetteTestCase, MarionetteTestCase,
skip, skip,
@ -275,12 +275,12 @@ class TestScreenCaptureChrome(WindowManagerMixin, ScreenCaptureTestCase):
self.marionette.navigate(box) self.marionette.navigate(box)
content_element = self.marionette.find_element(By.ID, "green") content_element = self.marionette.find_element(By.ID, "green")
self.assertRaisesRegexp(JavascriptException, "Element reference not seen before", self.assertRaisesRegexp(NoSuchElementException, "Element reference not seen before",
self.marionette.screenshot, highlights=[content_element]) self.marionette.screenshot, highlights=[content_element])
chrome_document_element = self.document_element chrome_document_element = self.document_element
with self.marionette.using_context('content'): with self.marionette.using_context('content'):
self.assertRaisesRegexp(JavascriptException, "Element reference not seen before", self.assertRaisesRegexp(NoSuchElementException, "Element reference not seen before",
self.marionette.screenshot, self.marionette.screenshot,
highlights=[chrome_document_element]) highlights=[chrome_document_element])