Backed out changeset 5df04b130a16 (bug 1499057) for Wd failures in /webdriver/tests/element_send_keys/interactability.py CLOSED TREE
authorMargareta Eliza Balazs <ebalazs@mozilla.com>
Wed, 17 Oct 2018 17:09:21 +0300
changeset 490062 29c0fc82e879891cd13464dc028c1d1c4da14ece
parent 490061 3c175c006e65b1c139a1070d3d00e18e0d034d49
child 490063 7bbf53a4fc3c8d29cc6ebcd6fc4a92e26b106937
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
bugs1499057
milestone64.0a1
backs out5df04b130a16afcaa917204055b8227f1ef0f411
Backed out changeset 5df04b130a16 (bug 1499057) for Wd failures in /webdriver/tests/element_send_keys/interactability.py CLOSED TREE
testing/web-platform/tests/tools/webdriver/webdriver/client.py
--- a/testing/web-platform/tests/tools/webdriver/webdriver/client.py
+++ b/testing/web-platform/tests/tools/webdriver/webdriver/client.py
@@ -371,16 +371,17 @@ class Session(object):
         self.transport = transport.HTTPWireProtocol(
             host, port, url_prefix, timeout=timeout)
         self.requested_capabilities = capabilities
         self.capabilities = None
         self.session_id = None
         self.timeouts = None
         self.window = None
         self.find = None
+        self._element_cache = {}
         self.extension = None
         self.extension_cls = extension
 
         self.timeouts = Timeouts(self)
         self.window = Window(self)
         self.find = Find(self)
         self.alert = UserPrompt(self)
         self.actions = Actions(self)
@@ -663,26 +664,32 @@ class Element(object):
 
         :param id: Web element UUID which must be unique across
             all browsing contexts.
         :param session: Current ``webdriver.Session``.
         """
         self.id = id
         self.session = session
 
+        if id in self.session._element_cache:
+            raise ValueError("Element already in cache: %s" % id)
+        self.session._element_cache[self.id] = self
+
     def __repr__(self):
         return "<%s %s>" % (self.__class__.__name__, self.id)
 
     def __eq__(self, other):
         return (isinstance(other, Element) and self.id == other.id and
                 self.session == other.session)
 
     @classmethod
     def from_json(cls, json, session):
         uuid = json[Element.identifier]
+        if uuid in session._element_cache:
+            return session._element_cache[uuid]
         return cls(uuid, session)
 
     def send_element_command(self, method, uri, body=None):
         url = "element/%s/%s" % (self.id, uri)
         return self.session.send_session_command(method, url, body)
 
     @command
     def find_element(self, strategy, selector):