Author: lzoubek(a)redhat.com
Date: 2010-05-04 07:17:31 -0400 (Tue, 04 May 2010)
New Revision: 21884
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotBrowserExt.java
Log:
SWTBot ext : added executeScript method to browser component
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotBrowserExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotBrowserExt.java 2010-05-04
07:27:54 UTC (rev 21883)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotBrowserExt.java 2010-05-04
11:17:31 UTC (rev 21884)
@@ -10,6 +10,7 @@
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.Result;
import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;
import org.hamcrest.SelfDescribing;
@@ -123,6 +124,30 @@
}
});
}
+ /**
+ * executes script in browser
+ * @param javaScript
+ * @return true if script was successfully executed
+ */
+ public boolean executeScript(final String javaScript) {
+ return UIThreadRunnable.syncExec(new Result<Boolean>() {
+ public Boolean run() {
+ return widget.execute(javaScript);
+ }
+ });
+
+ }
+ /**
+ * executes script in browser asynchronously
+ * @param javaScript
+ */
+ public void executeScriptAsync(final String javaScript) {
+ UIThreadRunnable.asyncExec(new VoidResult(){
+
+ public void run() {
+ widget.execute(javaScript);
+ }});
+ }
public void forward() {
UIThreadRunnable.syncExec(new VoidResult() {
public void run() {
Show replies by date