Bug 1096571 - Don't call into webdriver's isShown() method when manipulating content XUL in marionette, r=AutomatedTester

--HG--
extra : rebase_source : 73029f3246e37a958ba8a6c90bf0c11a97f389c2
This commit is contained in:
Andrew Halberstadt 2014-11-10 16:44:00 -05:00
parent ecf69cd339
commit f547a9e2fc
2 changed files with 17 additions and 6 deletions

View File

@ -3,7 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from by import By
from errors import NoSuchElementException
from errors import NoSuchElementException, ElementNotVisibleException
from marionette_test import MarionetteTestCase
from wait import Wait
@ -16,10 +16,17 @@ class TestClick(MarionetteTestCase):
link.click()
self.assertEqual("Clicked", self.marionette.execute_script("return document.getElementById('mozLink').innerHTML;"))
def testClickingALinkMadeUpOfNumbersIsHandledCorrectly(self):
def test_clicking_a_link_made_up_of_numbers_is_handled_correctly(self):
test_html = self.marionette.absolute_url("clicks.html")
self.marionette.navigate(test_html)
self.marionette.find_element(By.LINK_TEXT, "333333").click()
Wait(self.marionette, timeout=30, ignored_exceptions=NoSuchElementException).until(
lambda m: m.find_element(By.ID, 'username'))
self.assertEqual(self.marionette.title, "XHTML Test Page")
def test_clicking_an_element_that_is_not_displayed_raises(self):
test_html = self.marionette.absolute_url('hidden.html')
self.marionette.navigate(test_html)
with self.assertRaises(ElementNotVisibleException):
self.marionette.find_element(By.ID, 'child').click()

View File

@ -805,11 +805,15 @@ function elementInViewport(el, x, y) {
* If they are not specified, then the center of the target is used.
*/
function checkVisible(el, x, y) {
//check if the element is visible
let visible = utils.isElementDisplayed(el);
if (!visible) {
return false;
// Bug 1094246 - Webdriver's isShown doesn't work with content xul
if (utils.getElementAttribute(el, "namespaceURI").indexOf("there.is.only.xul") == -1) {
//check if the element is visible
let visible = utils.isElementDisplayed(el);
if (!visible) {
return false;
}
}
if (el.tagName.toLowerCase() === 'body') {
return true;
}