Bug 1101172: Correct Exception thrown when passing invalid element search type; r=jgriffin

--HG--
extra : rebase_source : 8da9313980a4895b72dcff1f2e46efe241a14c26
This commit is contained in:
David Burns 2014-11-19 01:26:14 +00:00
parent d648e9fd93
commit 01773cfd32
2 changed files with 7 additions and 2 deletions

View File

@ -5,7 +5,7 @@
from marionette_test import MarionetteTestCase
from marionette import HTMLElement
from by import By
from errors import NoSuchElementException
from errors import NoSuchElementException, InvalidSelectorException
class TestElements(MarionetteTestCase):
@ -154,3 +154,8 @@ class TestElements(MarionetteTestCase):
fbody = self.marionette.find_element(By.TAG_NAME, 'body')
abody = self.marionette.get_active_element()
self.assertEqual(fbody, abody)
def test_throws_error_when_trying_to_use_invalid_selector_type(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
self.assertRaises(InvalidSelectorException, self.marionette.find_element, "Brie Search Type", "doesn't matter")

View File

@ -293,7 +293,7 @@ ElementManager.prototype = {
let startNode = (values.element != undefined) ?
this.getKnownElement(values.element, win) : win.document;
if (this.elementStrategies.indexOf(values.using) < 0) {
throw new ElementException("No such strategy.", 17, null);
throw new ElementException("No such strategy.", 32, null);
}
let found = all ? this.findElements(values.using, values.value, win.document, startNode) :
this.findElement(values.using, values.value, win.document, startNode);