From ffe20afd295590723cda816a731f8de43a872924 Mon Sep 17 00:00:00 2001
From: Andreas Tolfsen <ato@sny.no>
Date: Wed, 25 Oct 2017 09:59:52 +0100
Subject: [PATCH] Bug 1411281 - Add equality test for webdriver.Element
 r=jgraham

When comparing two instances of webdriver.Element we want to first
check the type, to make sure the "id" attribute is present, then
compare the web element reference UUIDs.  These are supposed to be
unique across all browsing contexts.

MozReview-Commit-ID: 68PUBQxPdQ5

--HG--
extra : rebase_source : f0c52efd0db3a13ea1b90dc6c058ebee2de76e1d
---
 .../web-platform/tests/tools/webdriver/webdriver/client.py    | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testing/web-platform/tests/tools/webdriver/webdriver/client.py b/testing/web-platform/tests/tools/webdriver/webdriver/client.py
index 99e24eb720bf6..5eb7303ae2fd0 100644
--- a/testing/web-platform/tests/tools/webdriver/webdriver/client.py
+++ b/testing/web-platform/tests/tools/webdriver/webdriver/client.py
@@ -625,6 +625,10 @@ class Element(object):
         assert id not in self.session._element_cache
         self.session._element_cache[self.id] = self
 
+    def __eq__(self, other):
+        return isinstance(other, Element) and self.id == other.id \
+                and self.session == other.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)
-- 
GitLab