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
This commit is contained in:
Andreas Tolfsen 2017-10-25 09:59:52 +01:00
Родитель b0cfd27758
Коммит ffe20afd29
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -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)