From 631bf1089dc00225b2b25acbd50b09df30f9c043 Mon Sep 17 00:00:00 2001 From: wei <> Date: Thu, 1 Jun 2006 01:33:53 +0000 Subject: Override selenium getAttribute implementation. --- .../selenium/prado-functional-test.js | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'tests') diff --git a/tests/FunctionalTests/selenium/prado-functional-test.js b/tests/FunctionalTests/selenium/prado-functional-test.js index be2ea795..f9889a72 100644 --- a/tests/FunctionalTests/selenium/prado-functional-test.js +++ b/tests/FunctionalTests/selenium/prado-functional-test.js @@ -1,4 +1,45 @@ +/** + * Override selenium implementation. + */ +Selenium.prototype.getAttribute = function(target) { + return this.page().findAttribute(target); +}; + + +/** + * Override selenium implementation. + */ +Selenium.prototype.isVisible = function(locator) { + var element; + element = this.page().findElement(locator); + + if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)) + var visibility = element.style["visibility"]; + else + var visibility = this.findEffectiveStyleProperty(element, "visibility"); + + var _isDisplayed = this._isDisplayed(element); + return (visibility != "hidden" && _isDisplayed); +}; + + +/** + * Override selenium implementation. + */ +Selenium.prototype._isDisplayed = function(element) { + if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)) + var display = element.style["display"]; + else + var display = this.findEffectiveStyleProperty(element, "display"); + if (display == "none") return false; + if (element.parentNode.style) { + return this._isDisplayed(element.parentNode); + } + return true; +}; + + function runNextTest() { if (!runAllTests) return; -- cgit v1.2.3