Bug 1198542: Update Marionette element IDs to be valid UUID. r=ato

This allows WebDriver compatibility to create valid URI.

--HG--
extra : commitid : 7JjQgqwKr8P
extra : rebase_source : 30e59c18b69ab404608c6b44f1dc11742b95ac78
This commit is contained in:
David Burns 2015-08-26 19:52:09 +01:00
parent 1e59442474
commit 6b428e8150
2 changed files with 12 additions and 1 deletions

View File

@ -159,3 +159,13 @@ class TestElements(MarionetteTestCase):
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")
def test_element_id_is_valid_uuid(self):
import re
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
el = self.marionette.find_element(By.TAG_NAME, "body")
uuid_regex = re.compile('^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$')
self.assertIsNotNone(re.search(uuid_regex, el.id),
'UUID for the WebElement is not valid. ID is {}'\
.format(el.id))

View File

@ -233,7 +233,8 @@ ElementManager.prototype = {
delete this.seenItems[i];
}
}
let id = uuidGen.generateUUID().toString();
let uuid = uuidGen.generateUUID().toString();
let id = uuid.substring(1, uuid.length - 1);
this.seenItems[id] = Components.utils.getWeakReference(element);
return id;
},