test_element_rect.py (779B)
1 # This Source Code Form is subject to the terms of the Mozilla Public 2 # License, v. 2.0. If a copy of the MPL was not distributed with this 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 5 from urllib.parse import quote 6 7 from marionette_driver.by import By 8 from marionette_harness import MarionetteTestCase 9 10 11 def inline(doc): 12 return "data:text/html;charset=utf-8,{}".format(quote(doc)) 13 14 15 class TestElementSize(MarionetteTestCase): 16 def test_payload(self): 17 self.marionette.navigate(inline("""<a href="#">link</a>""")) 18 rect = self.marionette.find_element(By.LINK_TEXT, "link").rect 19 self.assertTrue(rect["x"] > 0) 20 self.assertTrue(rect["y"] > 0) 21 self.assertTrue(rect["width"] > 0) 22 self.assertTrue(rect["height"] > 0)