Hi Jevon,
Check me out!
--- On Tue, 22/12/09, Jevon Wright <je...@jevon.org> wrote:
From: Jevon Wright <je...@jevon.org>
Subject: Re: [JWebUnit-users] Issues running JWebUnit test (tinyMce and
javascript Confirm box)
To: "Usage problems for JWebUnit" <jwebunit-users@lists.sourceforge.net>
Date: Tuesday, 22 December, 2009, 7:35 PM
Hi Emerson,
For your first exception, it looks like it is being thrown when the page is
accessed. It looks like the "tinyMCE" variable is not defined. Can you debug
your script to make sure that it is defined before it is loaded? We use
HtmlUnit natively and it appears this supports TinyMCE without any problems, so
it may be a problem with your setup.
For your second exception, you need to set the expected prompt _before_
navigating away from the page:
setExpectedJavaScriptConfirm("You are about to remove BrandService(s) from
this site. Continue?",true); // before navigating away
checkCheckbox("selectedBrandServiceIds");
clickButtonWithText("Remove");
Hope this helps
Jevon
On Fri, Dec 18, 2009 at 7:01 PM, emerson sanchez <es_sanch...@yahoo.com> wrote:
Hi,
I'm having some issues using JWebUnit. I'm using version 2.1. First
is, I wasn't able to fill in a textarea which implements tinyMce.
Although the build was successful, it throws an exception and the text I
typed wasn't saved. Another is that I can't configure JWebUnit to answer
yes to a javascript confirm box. I have a code that clicks a button
which then triggers a confirm box. As I checked the mailing list, there
are some who has the same problem as I mine but AFAIK they didn't find a
solution yet. Are these issues fixed already that I just can't make my
own code work?
Here is the code regarding the textarea issue
setTextField("h1SearchText", "Configurable H1 Text"); //this
is the textarea
clickButton("saveH1Search");
//this is a submit button
Here is the exception.
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "tinyMCE"
is not defined. (JavaScriptBackgroundJob#1)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3558)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3536)
at
org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3621)
at
org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1653)
at
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3413)
at
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
at
com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:170)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3004)
at
org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$5.doRun(JavaScriptEngine.java:396)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:522)
---------------------------------------------------------------------------------------------------------------------------------------------------
Here is the code for the confirm box.
checkCheckbox("selectedBrandServiceIds");
clickButtonWithText("Remove");
setExpectedJavaScriptConfirm("You are about to remove
BrandService(s) from this site. Continue?",true);
Exception:
Tests run: 12, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 56.734
sec <<< FAILURE!
testRemoveBrandServiceFromSite(com.voxsant.pcs.jwebunit.WebTest) Time
elapsed: 7.704 sec <<< ERROR!
java.lang.RuntimeException:
com.gargoylesoftware.htmlunit.ScriptException: Wrapped
net.sourceforge.jwebunit.exception.UnexpectedJavascriptConfirmException:
A unexpected confirm with message [You are about to remove
BrandService(s) from this site. Continue?] was displayed (script in
http://localhost:8080/edit-site.html?id=1 from (471, 32) to (668, 10)#532)
at
net.sourceforge.jwebunit.htmlunit.HtmlUnitTestingEngineImpl.clickButtonWithText(HtmlUnitTestingEngineImpl.java:1886)
at
net.sourceforge.jwebunit.junit.WebTester.clickButtonWithText(WebTester.java:2530)
at
net.sourceforge.jwebunit.junit.WebTestCase.clickButtonWithText(WebTestCase.java:2029)
at
com.voxsant.pcs.jwebunit.WebTest.testRemoveBrandServiceFromSite(WebTest.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at
net.sourceforge.jwebunit.junit.WebTestCase.runBare(WebTestCase.java:79)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: com.gargoylesoftware.htmlunit.ScriptException: Wrapped
net.sourceforge.jwebunit.exception.UnexpectedJavascriptConfirmException:
A unexpected confirm with message [You are about to remove
BrandService(s) from this site. Continue?] was displayed (script in
http://localhost:8080/edit-site.html?id=1 from (471, 32) to (668, 10)#532)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)
at org.mozilla.javascript.Context.call(Context.java:502)
at
org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:437)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:917)
at
com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:143)
at
com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:156)
at
com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:550)
at
com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:1251)
at org.mozilla.javascript.Context.call(Context.java:502)
at
org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)
at
com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:1255)
at
com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:136)
at
com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:107)
at
com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:76)
at
net.sourceforge.jwebunit.htmlunit.HtmlUnitTestingEngineImpl.clickButtonWithText(HtmlUnitTestingEngineImpl.java:1884)
... 27 more
Caused by: org.mozilla.javascript.WrappedException: Wrapped
net.sourceforge.jwebunit.exception.UnexpectedJavascriptConfirmException:
A unexpected confirm with message [You are about to remove
BrandService(s) from this site. Continue?] was displayed (script in
http://localhost:8080/edit-site.html?id=1 from (471, 32) to (668, 10)#532)
at
org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1657)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:176)
at
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:478)
at
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
at
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
at
com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:170)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3004)
at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
at
com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:78)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:465)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:430)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:522)
... 42 more
Caused by:
net.sourceforge.jwebunit.exception.UnexpectedJavascriptConfirmException:
A unexpected confirm with message [You are about to remove
BrandService(s) from this site. Continue?] was displayed
at
net.sourceforge.jwebunit.htmlunit.HtmlUnitTestingEngineImpl$3.handleConfirm(HtmlUnitTestingEngineImpl.java:830)
at
com.gargoylesoftware.htmlunit.javascript.host.Window.jsxFunction_confirm(Window.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
... 54 more
Thanks,
Emerson
Check me out!
Get your new Email address!
Grab the Email name you've always wanted before someone else does!
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
-----Inline Attachment Follows-----
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users
New Email addresses available on Yahoo!
Get the Email name you've always wanted on the new @ymail and @rocketmail.
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users