Skip to content

Commit

Permalink
LPS-34059 SF
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchandotcom committed Mar 31, 2013
1 parent 0a25dc4 commit 2f6d52b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
Expand Up @@ -15,6 +15,7 @@
package com.liferay.portalweb.portal.util.liferayselenium;

import com.liferay.portal.kernel.util.FileUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portalweb.portal.util.RuntimeVariables;
import com.liferay.portalweb.portal.util.TestPropsValues;
Expand Down Expand Up @@ -253,18 +254,21 @@ public void keyUpAndWait(String locator, String keySequence) {
}

public void makeVisible(String locator) {
String script =
"var xpathResult =" +
"document.evaluate(" + locator + ", document, null," +
"XPathResult.FIRST_ORDERED_NODE_TYPE, null);" +
"if (xpathResult.singleNodeValue) {" +
"var element = xpathResult.singleNodeValue;" +
"element.style.display='inline-block';" +
"element.style.overflow='visible';" +
"element.style.visibility='visible';" +
"}";

super.runScript(script);
StringBundler sb = new StringBundler(10);

sb.append("var xpathResult = document.evaluate(");
sb.append(locator);
sb.append(", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, ");
sb.append("null);");

sb.append("if (xpathResult.singleNodeValue) {");
sb.append("var element = xpathResult.singleNodeValue;");
sb.append("element.style.display = 'inline-block';");
sb.append("element.style.overflow = 'visible';");
sb.append("element.style.visibility = 'visible';");
sb.append("}");

super.runScript(sb.toString());
}

public void paste(String location) {
Expand Down
Expand Up @@ -300,8 +300,6 @@ public void keyUpAndWait(String locator, String keySequence) {
}

public void makeVisible(String locator) {
WebElement webElement = getWebElement(locator);

WebElement bodyElement = getWebElement("//body");

WrapsDriver wrapsDriver = (WrapsDriver)bodyElement;
Expand All @@ -310,13 +308,16 @@ public void makeVisible(String locator) {

JavascriptExecutor javascriptExecutor = (JavascriptExecutor)webDriver;

String code =
"var element = arguments[0];" +
"element.style.display='inline-block';" +
"element.style.overflow='visible';" +
"element.style.visibility='visible';";
StringBundler sb = new StringBundler(4);

sb.append("var element = arguments[0];");
sb.append("element.style.display = 'inline-block';");
sb.append("element.style.overflow = 'visible';");
sb.append("element.style.visibility = 'visible';");

WebElement webElement = getWebElement(locator);

javascriptExecutor.executeScript(code, webElement);
javascriptExecutor.executeScript(sb.toString(), webElement);
}

public void paste(String location) {
Expand Down
13 changes: 6 additions & 7 deletions tools/selenium/extensions/ide.js
Expand Up @@ -29,16 +29,15 @@ Selenium.prototype.doLabel = function() {
};

Selenium.prototype.doMakeVisible = function(locator) {
var xpathResult = document.evaluate(locator, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
var xPathResult = document.evaluate(locator, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);

if (xpathResult.singleNodeValue) {
var element = xpathResult.singleNodeValue;
if (xPathResult.singleNodeValue) {
var element = xPathResult.singleNodeValue;

element.style.display="inline-block";
element.style.overflow="visible";
element.style.visibility="visible";
element.style.display = "inline-block";
element.style.overflow = "visible";
element.style.visibility = "visible";
}

};

Selenium.prototype.doSetBrowserOption = function(value) {
Expand Down

0 comments on commit 2f6d52b

Please sign in to comment.