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
parent 3c82b65dc7
commit 74b035b657
2 changed files with 6 additions and 5 deletions

View File

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

View File

@ -9,7 +9,7 @@ import struct
import urllib
from marionette_driver import By
from marionette_driver.errors import JavascriptException, NoSuchWindowException
from marionette_driver.errors import NoSuchElementException, NoSuchWindowException
from marionette_harness import (
MarionetteTestCase,
skip,
@ -275,12 +275,12 @@ class TestScreenCaptureChrome(WindowManagerMixin, ScreenCaptureTestCase):
self.marionette.navigate(box)
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])
chrome_document_element = self.document_element
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,
highlights=[chrome_document_element])