Javascript error

View: New views
7 Messages — Rating Filter:   Alert me  

Javascript error

by Kumararaja Gunasekaran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi,

 

I'm trying to click a link/button which would inturn call a javascript locally within the page or calls a javascript function defined inside a .js file that was included in that page so when i try to click the link and wait for the response I'm getting the following stackTrace - any help would be appreciated:

 

Caused by: com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "js function name" is not defined.

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)

                at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)

                at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:574)

                at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1317)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1288)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1257)

                ... 25 more

Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "js function name" is not defined.

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3717)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1758)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2135)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3134)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)

                at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)

                at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)

                ... 40 more

 

 

Thanks,

Kumar.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Javascript error

by Ahmed Ashour :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi Kumararaja,
 
Please use latest snapshot in [1], and provide minimal test as hinted in [2]
 
Yours,
Ahmed
----
Blog: http://asashour.blogspot.com

From: Kumararaja Gunasekaran <kumar@...>
To: "htmlunit-user@..." <htmlunit-user@...>
Sent: Wed, October 21, 2009 1:16:12 PM
Subject: [Htmlunit-user] Javascript error

Hi,

 

I'm trying to click a link/button which would inturn call a javascript locally within the page or calls a javascript function defined inside a .js file that was included in that page so when i try to click the link and wait for the response I'm getting the following stackTrace - any help would be appreciated:

 

Caused by: com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "js function name" is not defined.

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)

                at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)

                at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:574)

                at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1317)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1288)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1257)

                ... 25 more

Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "js function name" is not defined.

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3717)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1758)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2135)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3134)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)

                at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)

                at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)

                ... 40 more

 

 

Thanks,

Kumar.


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Javascript error

by Kumararaja Gunasekaran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Ahmed,

 

I can't see any apis for 2.7 version yet - do you have any examples like using the javascript from htmlunit ?

 

Thanks,

Kumar.

 

From: Ahmed Ashour [mailto:asashour@...]
Sent: 21 October 2009 11:47
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Javascript error

 

Hi Kumararaja,

 

Please use latest snapshot in [1], and provide minimal test as hinted in [2]

 

Yours,

Ahmed

----
Blog: http://asashour.blogspot.com


From: Kumararaja Gunasekaran <kumar@...>
To: "htmlunit-user@..." <htmlunit-user@...>
Sent: Wed, October 21, 2009 1:16:12 PM
Subject: [Htmlunit-user] Javascript error

Hi,

 

I'm trying to click a link/button which would inturn call a javascript locally within the page or calls a javascript function defined inside a .js file that was included in that page so when i try to click the link and wait for the response I'm getting the following stackTrace - any help would be appreciated:

 

Caused by: com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "js function name" is not defined.

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)

                at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)

                at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:574)

                at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1317)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1288)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1257)

                ... 25 more

Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "js function name" is not defined.

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3717)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1758)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2135)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3134)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)

                at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)

                at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)

                ... 40 more

 

 

Thanks,

Kumar.


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Javascript error

by Ahmed Ashour :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi,
 
There is nothing special for 2.7.
 
 
The main point, please provide minimal test case (web application) that works differently with HtmlUnit than with real browsers.
 
Yours,
Ahmed
----
Blog: http://asashour.blogspot.com
 

From: Kumararaja Gunasekaran <kumar@...>
To: "htmlunit-user@..." <htmlunit-user@...>
Sent: Wed, October 21, 2009 3:23:05 PM
Subject: Re: [Htmlunit-user] Javascript error

Ahmed,

 

I can't see any apis for 2.7 version yet - do you have any examples like using the javascript from htmlunit ?

 

Thanks,

Kumar.

 

From: Ahmed Ashour [mailto:asashour@...]
Sent: 21 October 2009 11:47
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Javascript error

 

Hi Kumararaja,

 

Please use latest snapshot in [1], and provide minimal test as hinted in [2]

 

[1] http://build.canoo.com/htmlunit/artifacts

[2] http://htmlunit.sourceforge.net/submittingJSBugs.html

Yours,

Ahmed

----
Blog: http://asashour.blogspot.com


From: Kumararaja Gunasekaran <kumar@...>
To: "htmlunit-user@..." <htmlunit-user@...>
Sent: Wed, October 21, 2009 1:16:12 PM
Subject: [Htmlunit-user] Javascript error

Hi,

 

I'm trying to click a link/button which would inturn call a javascript locally within the page or calls a javascript function defined inside a .js file that was included in that page so when i try to click the link and wait for the response I'm getting the following stackTrace - any help would be appreciated:

 

Caused by: com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "js function name" is not defined.

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)

                at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)

                at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:574)

                at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1317)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1288)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1257)

                ... 25 more

Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "js function name" is not defined.

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3717)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1758)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2135)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3134)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)

                at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)

                at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)

                ... 40 more

 

 

Thanks,

Kumar.


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Javascript error

by Kumararaja Gunasekaran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Ahmed,

 

I've been using HtmlUnit for a while and am not new to this testing framework and have scraped couple of websites some with https, and with much complexity as well.

 

But I've always disabled the javascript and used before but now i want to enable js and use it ...i tried with Selenium which is working but I needto download the file content as in HtmlUnit - click().getWebResponse().getContentAsString();  but i can't use it in selenium like this ..

 

so again I hadto use the Htmlunit to simulate this js event / function call...

 

as in my first posted email - it can't find the javascript method when i click that button ?

 

could you send me an architectural flow for htmlunit vs javascript - some examples which actually calling a simple js method from an application - calling from a htmlunit?

 

any help would be much appreciated.

 

thanks,

Kumar.

 

 

From: Ahmed Ashour [mailto:asashour@...]
Sent: 21 October 2009 14:43
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Javascript error

 

Hi,

 

There is nothing special for 2.7.

 

 

The main point, please provide minimal test case (web application) that works differently with HtmlUnit than with real browsers.

 

Yours,

Ahmed

----
Blog: http://asashour.blogspot.com

 


From: Kumararaja Gunasekaran <kumar@...>
To: "htmlunit-user@..." <htmlunit-user@...>
Sent: Wed, October 21, 2009 3:23:05 PM
Subject: Re: [Htmlunit-user] Javascript error

Ahmed,

 

I can't see any apis for 2.7 version yet - do you have any examples like using the javascript from htmlunit ?

 

Thanks,

Kumar.

 

From: Ahmed Ashour [mailto:asashour@...]
Sent: 21 October 2009 11:47
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Javascript error

 

Hi Kumararaja,

 

Please use latest snapshot in [1], and provide minimal test as hinted in [2]

 

[1] http://build.canoo.com/htmlunit/artifacts

[2] http://htmlunit.sourceforge.net/submittingJSBugs.html

Yours,

Ahmed

----
Blog: http://asashour.blogspot.com


From: Kumararaja Gunasekaran <kumar@...>
To: "htmlunit-user@..." <htmlunit-user@...>
Sent: Wed, October 21, 2009 1:16:12 PM
Subject: [Htmlunit-user] Javascript error

Hi,

 

I'm trying to click a link/button which would inturn call a javascript locally within the page or calls a javascript function defined inside a .js file that was included in that page so when i try to click the link and wait for the response I'm getting the following stackTrace - any help would be appreciated:

 

Caused by: com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "js function name" is not defined.

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)

                at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)

                at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:574)

                at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1317)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1288)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1257)

                ... 25 more

Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "js function name" is not defined.

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3717)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1758)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2135)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3134)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)

                at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)

                at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)

                ... 40 more

 

 

Thanks,

Kumar.


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Javascript error

by Ahmed Ashour :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi Kumararaja,
 
Ideally, you shouldn't directly call any javascript, it is done automatically when you click() hyperlink, button, etc. That's the beauty of HtmlUnit, you don't need to know the internal behavior of the application, but just find an element, click(), and get the results.
 
HtmlPage.executeJavaScript() can be used to directly call arbitrary JavaScript. An example of using it can be found in [1]
 
Again, it would be much better if you provide a minimal case that gives an error on 'clicking' an element, so we can fix HtmlUnit issues.
 
 
Yours,
Ahmed
----
Blog: http://asashour.blogspot.com

From: Kumararaja Gunasekaran <kumar@...>
To: "htmlunit-user@..." <htmlunit-user@...>
Sent: Wed, October 21, 2009 4:55:13 PM
Subject: Re: [Htmlunit-user] Javascript error

Ahmed,

 

I've been using HtmlUnit for a while and am not new to this testing framework and have scraped couple of websites some with https, and with much complexity as well.

 

But I've always disabled the javascript and used before but now i want to enable js and use it ...i tried with Selenium which is working but I needto download the file content as in HtmlUnit - click().getWebResponse().getContentAsString();  but i can't use it in selenium like this ..

 

so again I hadto use the Htmlunit to simulate this js event / function call...

 

as in my first posted email - it can't find the javascript method when i click that button ?

 

could you send me an architectural flow for htmlunit vs javascript - some examples which actually calling a simple js method from an application - calling from a htmlunit?

 

any help would be much appreciated.

 

thanks,

Kumar.

 

 

From: Ahmed Ashour [mailto:asashour@...]
Sent: 21 October 2009 14:43
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Javascript error

 

Hi,

 

There is nothing special for 2.7.

 

Please read http://htmlunit.sourceforge.net/gettingStarted.html, and http://htmlunit.sourceforge.net/javascript-howto.html

 

The main point, please provide minimal test case (web application) that works differently with HtmlUnit than with real browsers.

 

Yours,

Ahmed

----
Blog: http://asashour.blogspot.com

 


From: Kumararaja Gunasekaran <kumar@...>
To: "htmlunit-user@..." <htmlunit-user@...>
Sent: Wed, October 21, 2009 3:23:05 PM
Subject: Re: [Htmlunit-user] Javascript error

Ahmed,

 

I can't see any apis for 2.7 version yet - do you have any examples like using the javascript from htmlunit ?

 

Thanks,

Kumar.

 

From: Ahmed Ashour [mailto:asashour@...]
Sent: 21 October 2009 11:47
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Javascript error

 

Hi Kumararaja,

 

Please use latest snapshot in [1], and provide minimal test as hinted in [2]

 

[1] http://build.canoo.com/htmlunit/artifacts

[2] http://htmlunit.sourceforge.net/submittingJSBugs.html

Yours,

Ahmed

----
Blog: http://asashour.blogspot.com


From: Kumararaja Gunasekaran <kumar@...>
To: "htmlunit-user@..." <htmlunit-user@...>
Sent: Wed, October 21, 2009 1:16:12 PM
Subject: [Htmlunit-user] Javascript error

Hi,

 

I'm trying to click a link/button which would inturn call a javascript locally within the page or calls a javascript function defined inside a .js file that was included in that page so when i try to click the link and wait for the response I'm getting the following stackTrace - any help would be appreciated:

 

Caused by: com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "js function name" is not defined.

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)

                at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)

                at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:574)

                at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1317)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1288)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1257)

                ... 25 more

Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "js function name" is not defined.

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3717)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1758)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2135)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3134)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)

                at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)

                at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)

                ... 40 more

 

 

Thanks,

Kumar.


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

 


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Javascript error

by Kumararaja Gunasekaran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi Ahmed,

 

Thanks for the reply.

 

I was actually just clicking a button to get some table results within a page - it was not updated the table data when i disabled the javascript so now i enabled the javascript and doing the same click button but it doesn't work though - throws error like it can't find the javascript method which is being called when i click the button ...

 

I was not calling the javascript funtion directly - even though i did try but it was not working anyway

 

Is there a template or something that I can use to give you a minimal case or example - since I'm new to this email lists - i do not know much of the process

 

let me know if the above information isn't enough?

 

Thanks,

Kumar.

 

From: Ahmed Ashour [mailto:asashour@...]
Sent: 21 October 2009 21:12
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Javascript error

 

Hi Kumararaja,

 

Ideally, you shouldn't directly call any javascript, it is done automatically when you click() hyperlink, button, etc. That's the beauty of HtmlUnit, you don't need to know the internal behavior of the application, but just find an element, click(), and get the results.

 

HtmlPage.executeJavaScript() can be used to directly call arbitrary JavaScript. An example of using it can be found in [1]

 

Again, it would be much better if you provide a minimal case that gives an error on 'clicking' an element, so we can fix HtmlUnit issues.

 

 

Yours,

Ahmed

----
Blog: http://asashour.blogspot.com


From: Kumararaja Gunasekaran <kumar@...>
To: "htmlunit-user@..." <htmlunit-user@...>
Sent: Wed, October 21, 2009 4:55:13 PM
Subject: Re: [Htmlunit-user] Javascript error

Ahmed,

 

I've been using HtmlUnit for a while and am not new to this testing framework and have scraped couple of websites some with https, and with much complexity as well.

 

But I've always disabled the javascript and used before but now i want to enable js and use it ...i tried with Selenium which is working but I needto download the file content as in HtmlUnit - click().getWebResponse().getContentAsString();  but i can't use it in selenium like this ..

 

so again I hadto use the Htmlunit to simulate this js event / function call...

 

as in my first posted email - it can't find the javascript method when i click that button ?

 

could you send me an architectural flow for htmlunit vs javascript - some examples which actually calling a simple js method from an application - calling from a htmlunit?

 

any help would be much appreciated.

 

thanks,

Kumar.

 

 

From: Ahmed Ashour [mailto:asashour@...]
Sent: 21 October 2009 14:43
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Javascript error

 

Hi,

 

There is nothing special for 2.7.

 

Please read http://htmlunit.sourceforge.net/gettingStarted.html, and http://htmlunit.sourceforge.net/javascript-howto.html

 

The main point, please provide minimal test case (web application) that works differently with HtmlUnit than with real browsers.

 

Yours,

Ahmed

----
Blog: http://asashour.blogspot.com

 


From: Kumararaja Gunasekaran <kumar@...>
To: "htmlunit-user@..." <htmlunit-user@...>
Sent: Wed, October 21, 2009 3:23:05 PM
Subject: Re: [Htmlunit-user] Javascript error

Ahmed,

 

I can't see any apis for 2.7 version yet - do you have any examples like using the javascript from htmlunit ?

 

Thanks,

Kumar.

 

From: Ahmed Ashour [mailto:asashour@...]
Sent: 21 October 2009 11:47
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Javascript error

 

Hi Kumararaja,

 

Please use latest snapshot in [1], and provide minimal test as hinted in [2]

 

[1] http://build.canoo.com/htmlunit/artifacts

[2] http://htmlunit.sourceforge.net/submittingJSBugs.html

Yours,

Ahmed

----
Blog: http://asashour.blogspot.com


From: Kumararaja Gunasekaran <kumar@...>
To: "htmlunit-user@..." <htmlunit-user@...>
Sent: Wed, October 21, 2009 1:16:12 PM
Subject: [Htmlunit-user] Javascript error

Hi,

 

I'm trying to click a link/button which would inturn call a javascript locally within the page or calls a javascript function defined inside a .js file that was included in that page so when i try to click the link and wait for the response I'm getting the following stackTrace - any help would be appreciated:

 

Caused by: com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "js function name" is not defined.

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)

                at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)

                at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)

                at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:574)

                at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)

                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1317)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1288)

                at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1257)

                ... 25 more

Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "js function name" is not defined.

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3717)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1758)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2135)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3134)

                at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)

                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)

                at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)

                at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)

                at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)

                at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)

                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)

                ... 40 more

 

 

Thanks,

Kumar.


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

 


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user