Problem executing JS

Next Topic
 
classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem executing JS

Tobias G.-2
Hi,

I'm new to HtmlUnit (since a few days) and have a problem with an external website I don't have access to.
There are two HtmlSelects on it. The first one ("model") has got static attributes. But the second one ("variant") is empty when I load the page. It gets filled when I select an option in the first HtmlSelect. But it doesn't work for me (at least not with HtmlUnit). I think it's a JS problem since HtmlUnit throws a few JS errors like:

<error>
01.09.2010 11:09:57 com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine handleJavaScriptException
INFO: Caught script exception
======= EXCEPTION START ========
EcmaError: lineNumber=[0] column=[0] lineSource=[function () {] name=[ReferenceError] sourceName=[onchange event for HtmlSelect[<select name="model" tabindex="8" onchange="interval.value=0; document.forms[0].finished.value='0';  modelChange(this); //submit();">] in http://etis.warley.fordstar.com/csg/checksheet.do] message=[ReferenceError: "modelChange" is not defined.]
com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "modelChange" is not defined.
...
</error>


The above select is is the first select in HTML:
<select name="model" tabindex="8" onchange="interval.value=0; document.forms[0].finished.value='0';  modelChange(this); //submit();"><option value="0">Auswählen</option>

So, it should automatically run the JS function
"function modelChange(modelSelect) {...}"
when I select an item.
But it doesn't work just by selecting the first HtmlSelect with this code:

HtmlForm formGeneralOptions = pageGeneralOptions.getFormByName("CSGOptionsForm");
HtmlSelect selectModell = formGeneralOptions.getSelectByName("model");
selectModell.setSelectedAttribute("ABC", true);


When I then try to read out the second HtmlSelect, it's still empty.

HtmlSelect selectAusfuehrung = formGeneralOptions.getSelectByName("variant");
List lstAusfuehrung = selectAusfuehrung.getOptions();
for (int i = 0; i < lstAusfuehrung.size(); i++) {
HtmlOption h = (HtmlOption) lstAusfuehrung.get(i);
    System.out.println(h.asText());
}

I tried .click() or reload the whole page, but that didn't work neither (already thought so...)
How can I access the filled second select? Do I have to execute the onChange in another way?
I hope it is possible, since this is of much importance to me.
I don't have any problems with "static" options, since they don't use JS. This is the only site I can't configure well.

Thanks in advance.


Sincerely,
Tobias
  

WEB.DE DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für    
nur 19,99 €/mtl.!* http://web.de/DSL-Doppel-Flatrate/

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

Marc Guillemot
Hi,

where is the modelChange function defined?

Cheers,
Marc.
--
Blog: http://mguillem.wordpress.com


Le 01/09/2010 11:22, Tobias G. a écrit :

> Hi,
>
> I'm new to HtmlUnit (since a few days) and have a problem with an
> external website I don't have access to.
> There are two HtmlSelects on it. The first one ("model") has got static
> attributes. But the second one ("variant") is empty when I load the
> page. It gets filled when I select an option in the first HtmlSelect.
> But it doesn't work for me (at least not with HtmlUnit). I think it's a
> JS problem since HtmlUnit throws a few JS errors like:
>
> <error>
> 01.09.2010 11:09:57
> com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine
> handleJavaScriptException
> INFO: Caught script exception
> ======= EXCEPTION START ========
> EcmaError: lineNumber=[0] column=[0] lineSource=[function () {]
> name=[ReferenceError] sourceName=[onchange event for HtmlSelect[<select
> name="model" tabindex="8" onchange="interval.value=0;
> document.forms[0].finished.value='0'; modelChange(this); //submit();">]
> in http://etis.warley.fordstar.com/csg/checksheet.do]
> message=[ReferenceError: "modelChange" is not defined.]
> com.gargoylesoftware.htmlunit.ScriptException: ReferenceError:
> "modelChange" is not defined.
> ...
> </error>
>
>
> The above select is is the first select in HTML:
>
> <select  name="model"tabindex="8"onchange="interval.value=0; document.forms[0].finished.value='0';  modelChange(this); //submit();"><option  value="0">Auswählen</option>
>
> So, it should automatically run the JS function
> "function modelChange(modelSelect) {...}"
>
>
> when I select an item.
> But it doesn't work just by selecting the first HtmlSelect with this code:
>
> HtmlForm formGeneralOptions = pageGeneralOptions.getFormByName("CSGOptionsForm");
> HtmlSelect selectModell = formGeneralOptions.getSelectByName("model");
> selectModell.setSelectedAttribute("ABC", true);
>
>
> When I then try to read out the second HtmlSelect, it's still empty.
>
> HtmlSelect selectAusfuehrung = formGeneralOptions.getSelectByName("variant");
> List lstAusfuehrung = selectAusfuehrung.getOptions();
> for (int i = 0; i<  lstAusfuehrung.size(); i++) {
>   HtmlOption h = (HtmlOption) lstAusfuehrung.get(i);
>         System.out.println(h.asText());
> }
>
> I tried .click() or reload the whole page, but that didn't work neither
> (already thought so...)
> How can I access the filled second select? Do I have to execute the
> onChange in another way?
> I hope it is possible, since this is of much importance to me.
> I don't have any problems with "static" options, since they don't use
> JS. This is the only site I can't configure well.
>
> Thanks in advance.
>
>
> Sincerely,
> Tobias


------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

Tobias G.-2
Hi,

sorry for the unformatted text yesterday :( I rarely write mails via web interface.
To answer your question:
The JS is defined directly in the body, but outside the form.

<head>
 <script type="text/javascript" src="/js/ajaxUtil.js"></script>
 <script type="text/javascript">
 <!--  to hide script contents from old browsers
 function myNewWindow()
 {
some_new_window=open("/contextualHelp.do?contextualHelpId=Information/h000023","help","top=150,left=450,menubar=no,toolbar=no,scrollbar=yes,scrollbars=yes,resizable=yes,width=450,height=500,status=yes");
 }
 // end hiding contents from old browsers  -->
 </script>
</head>
<body>
"some tables"
<script language="JavaScript" type="text/javascript">
 var variantOptionSelect = new Option("Auswählen", "0", false, false);
 var variantOptionLoading = new Option("Wird geladen...", "0", false, false);
 var intervalOptionSelect = new Option("Auswählen", "-1", false, false);
 var intervalOptionLoading = new Option("Wird geladen...", "-1", false, false);
 function modelChange(modelSelect)
 {...}
 function modelChangeCallback(handler)
 {...}
 function variantChange(variantSelect)
 {...}
 function variantChangeCallback(handler)
 {...}
</script>
"some tables"
<form>
"html selects"
</form>


So, I just saw the causes from the exceptions:
[error]
01.09.2010 11:09:57 com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine handleJavaScriptException
INFO: Caught script exception
======= EXCEPTION START ========
EcmaError:
lineNumber=[0] column=[0] lineSource=[function () {]
name=[ReferenceError] sourceName=[onchange event for
HtmlSelect[<select name="model" tabindex="8" onchange="interval.value=0; document.forms[0].finished.value='0'; modelChange(this); //submit();">] in [[http://etis.warley.fordstar.com/csg/checksheet.do]]] message=[ReferenceError: "modelChange" is not defined.]
com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "modelChange" is not defined.
...
Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "modelChange" is not defined.
...
Another exception...
Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "variantChange" is not defined.
[/error]

Seems HtmlUnit doesn't find the functions.



Problem 2:
I just encountered another thing with a button.
If I disable JS I can click the button, but with JS enabled the button doesn't work.
<input type="button" name="continue" tabindex="19" onclick="document.forms[0].finished.value='1'; submit();" value="Fortfahren">
There are some exceptions, too:

<error>
02.09.2010 10:12:43 com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNUNG: Obsolete content type encountered: 'text/javascript'.
02.09.2010 10:12:44 com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine handleJavaScriptException
INFO: Caught script exception
======= EXCEPTION START ========
EcmaError: lineNumber=[0] column=[0] lineSource=[function () {] name=[ReferenceError] sourceName=[onload event for HtmlBody[<body onload="serviceOrPretestCheckChange(document.forms[0].service.checked, document.forms[0].preTest.checked);">] in http://etis.warley.fordstar.com/csg/checksheet.do] message=[ReferenceError: "serviceOrPretestCheckChange" is not defined.]
com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "serviceOrPretestCheckChange" is not defined.
...
Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "serviceOrPretestCheckChange" is not defined.
...
</error>

And afterwards there is an exception:
Exception in thread "AWT-EventQueue-0" com.gargoylesoftware.htmlunit.ElementNotFoundException: elementName=[button] attributeName=[name] attributeValue=[continue]


Seems to be the same problem as with the selects.
Problem 2 could be important because of one stupid question:
Do I have to enable JS before clicking on that button? If I do so, the button doesn't work?! I hoped, that enabling JS directly after loading the page would be enough. Is it?!


Thanks in advance.


Sincerely,
Tobias



-----Ursprüngliche Nachricht-----
Von: Marc Guillemot <[hidden email]>
Gesendet: 02.09.2010 15:26:19
An: [hidden email]
Betreff: Re: [Htmlunit-user] Problem executing JS

>Hi,
>
>where is the modelChange function defined?
>
>Cheers,
>Marc.
>--
>Blog: http://mguillem.wordpress.com
>
>
>Le 01/09/2010 11:22, Tobias G. a écrit :
>> Hi,
>>
>> I'm new to HtmlUnit (since a few days) and have a problem with an
>> external website I don't have access to.
>> There are two HtmlSelects on it. The first one ("model") has got static
>> attributes. But the second one ("variant") is empty when I load the
>> page. It gets filled when I select an option in the first HtmlSelect.
>> But it doesn't work for me (at least not with HtmlUnit). I think it's a
>> JS problem since HtmlUnit throws a few JS errors like:
>>
>> <error>
>> 01.09.2010 11:09:57
>> com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine
>> handleJavaScriptException
>> INFO: Caught script exception
>> ======= EXCEPTION START ========
>> EcmaError: lineNumber=[0] column=[0] lineSource=[function () {]
>> name=[ReferenceError] sourceName=[onchange event for HtmlSelect[<select
>> name="model" tabindex="8" onchange="interval.value=0;
>> document.forms[0].finished.value='0'; modelChange(this); //submit();">]
>> in http://etis.warley.fordstar.com/csg/checksheet.do]
>> message=[ReferenceError: "modelChange" is not defined.]
>> com.gargoylesoftware.htmlunit.ScriptException: ReferenceError:
>> "modelChange" is not defined.
>> ...
>> </error>
>>
>>
>> The above select is is the first select in HTML:
>>
>> Auswählen
>>
>> So, it should automatically run the JS function
>> "function modelChange(modelSelect) {...}"
>>
>>
>> when I select an item.
>> But it doesn't work just by selecting the first HtmlSelect with this code:
>>
>> HtmlForm formGeneralOptions = pageGeneralOptions.getFormByName("CSGOptionsForm");
>> HtmlSelect selectModell = formGeneralOptions.getSelectByName("model");
>> selectModell.setSelectedAttribute("ABC", true);
>>
>>
>> When I then try to read out the second HtmlSelect, it's still empty.
>>
>> HtmlSelect selectAusfuehrung = formGeneralOptions.getSelectByName("variant");
>> List lstAusfuehrung = selectAusfuehrung.getOptions();
>> for (int i = 0; i<  lstAusfuehrung.size(); i++) {
>>   HtmlOption h = (HtmlOption) lstAusfuehrung.get(i);
>>         System.out.println(h.asText());
>> }
>>
>> I tried .click() or reload the whole page, but that didn't work neither
>> (already thought so...)
>> How can I access the filled second select? Do I have to execute the
>> onChange in another way?
>> I hope it is possible, since this is of much importance to me.
>> I don't have any problems with "static" options, since they don't use
>> JS. This is the only site I can't configure well.
>>
>> Thanks in advance.
>>
>>
>> Sincerely,
>> Tobias
>
>
>------------------------------------------------------------------------------
>This SF.net Dev2Dev email is sponsored by:
>
>Show off your parallel programming skills.
>Enter the Intel(R) Threading Challenge 2010.
>http://p.sf.net/sfu/intel-thread-sfd
>_______________________________________________
>Htmlunit-user mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/htmlunit-user
___________________________________________________________
Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

Marc Guillemot
Hi,

do you call WebClient.setThrowExceptionOnScriptError(false)? If yes,
then the problem you see is probably the consequence of an earlier
error. If not, can you create a minimal example allowing to reproduce
the problem?

Cheers,
Marc.
--
Blog: http://mguillem.wordpress.com


Le 02/09/2010 19:29, Tobias G. a écrit :

> Hi,
>
> sorry for the unformatted text yesterday :( I rarely write mails via web interface.
> To answer your question:
> The JS is defined directly in the body, but outside the form.
>
> <head>
>   <script type="text/javascript" src="/js/ajaxUtil.js"></script>
>   <script type="text/javascript">
>   <!--  to hide script contents from old browsers
>   function myNewWindow()
>   {
> some_new_window=open("/contextualHelp.do?contextualHelpId=Information/h000023","help","top=150,left=450,menubar=no,toolbar=no,scrollbar=yes,scrollbars=yes,resizable=yes,width=450,height=500,status=yes");
>   }
>   // end hiding contents from old browsers  -->
>   </script>
> </head>
> <body>
> "some tables"
> <script language="JavaScript" type="text/javascript">
>   var variantOptionSelect = new Option("Auswählen", "0", false, false);
>   var variantOptionLoading = new Option("Wird geladen...", "0", false, false);
>   var intervalOptionSelect = new Option("Auswählen", "-1", false, false);
>   var intervalOptionLoading = new Option("Wird geladen...", "-1", false, false);
>   function modelChange(modelSelect)
>   {...}
>   function modelChangeCallback(handler)
>   {...}
>   function variantChange(variantSelect)
>   {...}
>   function variantChangeCallback(handler)
>   {...}
> </script>
> "some tables"
> <form>
> "html selects"
> </form>
>
>
> So, I just saw the causes from the exceptions:
> [error]
> 01.09.2010 11:09:57 com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine handleJavaScriptException
> INFO: Caught script exception
> ======= EXCEPTION START ========
> EcmaError:
> lineNumber=[0] column=[0] lineSource=[function () {]
> name=[ReferenceError] sourceName=[onchange event for
> HtmlSelect[<select name="model" tabindex="8" onchange="interval.value=0; document.forms[0].finished.value='0'; modelChange(this); //submit();">] in [[http://etis.warley.fordstar.com/csg/checksheet.do]]] message=[ReferenceError: "modelChange" is not defined.]
> com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "modelChange" is not defined.
> ...
> Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "modelChange" is not defined.
> ...
> Another exception...
> Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "variantChange" is not defined.
> [/error]
>
> Seems HtmlUnit doesn't find the functions.
>
>
>
> Problem 2:
> I just encountered another thing with a button.
> If I disable JS I can click the button, but with JS enabled the button doesn't work.
> <input type="button" name="continue" tabindex="19" onclick="document.forms[0].finished.value='1'; submit();" value="Fortfahren">
> There are some exceptions, too:
>
> <error>
> 02.09.2010 10:12:43 com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
> WARNUNG: Obsolete content type encountered: 'text/javascript'.
> 02.09.2010 10:12:44 com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine handleJavaScriptException
> INFO: Caught script exception
> ======= EXCEPTION START ========
> EcmaError: lineNumber=[0] column=[0] lineSource=[function () {] name=[ReferenceError] sourceName=[onload event for HtmlBody[<body onload="serviceOrPretestCheckChange(document.forms[0].service.checked, document.forms[0].preTest.checked);">] in http://etis.warley.fordstar.com/csg/checksheet.do] message=[ReferenceError: "serviceOrPretestCheckChange" is not defined.]
> com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "serviceOrPretestCheckChange" is not defined.
> ...
> Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "serviceOrPretestCheckChange" is not defined.
> ...
> </error>
>
> And afterwards there is an exception:
> Exception in thread "AWT-EventQueue-0" com.gargoylesoftware.htmlunit.ElementNotFoundException: elementName=[button] attributeName=[name] attributeValue=[continue]
>
>
> Seems to be the same problem as with the selects.
> Problem 2 could be important because of one stupid question:
> Do I have to enable JS before clicking on that button? If I do so, the button doesn't work?! I hoped, that enabling JS directly after loading the page would be enough. Is it?!
>
>
> Thanks in advance.
>
>
> Sincerely,
> Tobias
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Marc Guillemot<[hidden email]>
> Gesendet: 02.09.2010 15:26:19
> An: [hidden email]
> Betreff: Re: [Htmlunit-user] Problem executing JS
>
>> Hi,
>>
>> where is the modelChange function defined?
>>
>> Cheers,
>> Marc.
>> --
>> Blog: http://mguillem.wordpress.com
>>
>>
>> Le 01/09/2010 11:22, Tobias G. a écrit :
>>> Hi,
>>>
>>> I'm new to HtmlUnit (since a few days) and have a problem with an
>>> external website I don't have access to.
>>> There are two HtmlSelects on it. The first one ("model") has got static
>>> attributes. But the second one ("variant") is empty when I load the
>>> page. It gets filled when I select an option in the first HtmlSelect.
>>> But it doesn't work for me (at least not with HtmlUnit). I think it's a
>>> JS problem since HtmlUnit throws a few JS errors like:
>>>
>>> <error>
>>> 01.09.2010 11:09:57
>>> com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine
>>> handleJavaScriptException
>>> INFO: Caught script exception
>>> ======= EXCEPTION START ========
>>> EcmaError: lineNumber=[0] column=[0] lineSource=[function () {]
>>> name=[ReferenceError] sourceName=[onchange event for HtmlSelect[<select
>>> name="model" tabindex="8" onchange="interval.value=0;
>>> document.forms[0].finished.value='0'; modelChange(this); //submit();">]
>>> in http://etis.warley.fordstar.com/csg/checksheet.do]
>>> message=[ReferenceError: "modelChange" is not defined.]
>>> com.gargoylesoftware.htmlunit.ScriptException: ReferenceError:
>>> "modelChange" is not defined.
>>> ...
>>> </error>
>>>
>>>
>>> The above select is is the first select in HTML:
>>>
>>> Auswählen
>>>
>>> So, it should automatically run the JS function
>>> "function modelChange(modelSelect) {...}"
>>>
>>>
>>> when I select an item.
>>> But it doesn't work just by selecting the first HtmlSelect with this code:
>>>
>>> HtmlForm formGeneralOptions = pageGeneralOptions.getFormByName("CSGOptionsForm");
>>> HtmlSelect selectModell = formGeneralOptions.getSelectByName("model");
>>> selectModell.setSelectedAttribute("ABC", true);
>>>
>>>
>>> When I then try to read out the second HtmlSelect, it's still empty.
>>>
>>> HtmlSelect selectAusfuehrung = formGeneralOptions.getSelectByName("variant");
>>> List lstAusfuehrung = selectAusfuehrung.getOptions();
>>> for (int i = 0; i<   lstAusfuehrung.size(); i++) {
>>>    HtmlOption h = (HtmlOption) lstAusfuehrung.get(i);
>>>          System.out.println(h.asText());
>>> }
>>>
>>> I tried .click() or reload the whole page, but that didn't work neither
>>> (already thought so...)
>>> How can I access the filled second select? Do I have to execute the
>>> onChange in another way?
>>> I hope it is possible, since this is of much importance to me.
>>> I don't have any problems with "static" options, since they don't use
>>> JS. This is the only site I can't configure well.
>>>
>>> Thanks in advance.
>>>
>>>
>>> Sincerely,
>>> Tobias

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

agent0056
In reply to this post by Tobias G.-2
Hi Marc,

you're right, I set setThrowExceptionOnScriptError(false). When I enable it, I get the following exception (JS is enabled AFTER loading this webpage with click() since I even don't get there with JS enabled):
I had to change my email provider since the old one was refused most times.


Exception in thread "AWT-EventQueue-0" ======= EXCEPTION START ========
EcmaError: lineNumber=[0] column=[0] lineSource=[function () {] name=[ReferenceError] sourceName=[onchange event for HtmlSelect[<select name="model" tabindex="8" onchange="interval.value=0; document.forms[0].finished.value='0'; modelChange(this); //submit();">] in http://etis.warley.fordstar.com/csg/checksheet.do] message=[ReferenceError: "modelChange" is not defined.]
com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "modelChange" is not defined.
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:601)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:531)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:906)
at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:197)
at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:216)
at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:686)
at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:885)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:890)
at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:865)
at com.gargoylesoftware.htmlunit.html.HtmlInput.executeOnChangeHandlerIfAppropriate(HtmlInput.java:469)
at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:310)
at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:283)
at com.gargoylesoftware.htmlunit.html.HtmlOption.setSelected(HtmlOption.java:87)
at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:264)
at model.Client.setOptions(Client.java:331)
at view.GeneralOptions.setOrderOptions(GeneralOptions.java:437)
at view.GeneralOptions.actionPerformed(GeneralOptions.java:461)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:5517)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5282)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3984)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1791)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "modelChange" is not defined.
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3772)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3750)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3835)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1829)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2234)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1506)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:269)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3162)
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:559)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:524)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)
... 44 more
Enclosed exception:
net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "modelChange" is not defined.
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3772)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3750)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3835)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1829)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2234)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1506)
at script(onchange event for HtmlSelect[<select name="model" tabindex="8" onchange="interval.value=0; document.forms[0].finished.value='0'; modelChange(this); //submit();">] in http://etis.warley.fordstar.com/csg/checksheet.do)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:269)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3162)
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:559)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:524)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:531)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:906)
at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:197)
at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:216)
at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:686)
at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:885)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:890)
at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:865)
at com.gargoylesoftware.htmlunit.html.HtmlInput.executeOnChangeHandlerIfAppropriate(HtmlInput.java:469)
at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:310)
at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:283)
at com.gargoylesoftware.htmlunit.html.HtmlOption.setSelected(HtmlOption.java:87)
at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:264)
at model.Client.setOptions(Client.java:331)
at view.GeneralOptions.setOrderOptions(GeneralOptions.java:437)
at view.GeneralOptions.actionPerformed(GeneralOptions.java:461)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:5517)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5282)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3984)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1791)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
== CALLING JAVASCRIPT ==
function () {
[native code, arity=0]
}

======= EXCEPTION END ========


But that's still not very clear to me.

Sincerely,
Tobias
--
GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 Euro/mtl.!*
http://portal.gmx.net/de/go/dsl

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

agent0056
In reply to this post by Tobias G.-2
Hi,

would it be helpful if I post the JS code or the whole HTML page? I don't get any further with the JS problem. Everything else is working yet.

Greeting,

Tobias



> Hi Marc,
>
> you're right, I set setThrowExceptionOnScriptError(false). When I enable it, I get the following exception (JS is enabled AFTER loading this webpage with click() since I even don't get there with JS enabled):
> I had to change my email provider since the old one was refused most times.
>
>
> Exception in thread "AWT-EventQueue-0" ======= EXCEPTION START ========
> EcmaError: lineNumber=[0] column=[0] lineSource=[function () {] name=[ReferenceError] sourceName=[onchange event for HtmlSelect[<select name="model" tabindex="8" onchange="interval.value=0; document.forms[0].finished.value='0'; modelChange(this); //submit();">] in http://etis.warley.fordstar.com/csg/checksheet.do] message=[ReferenceError: "modelChange" is not defined.]
> com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "modelChange" is not defined.
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:601)
> at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
> at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:531)
> at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:906)
> at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:197)
> at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:216)
> at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:686)
> at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:885)
> at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
> at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
> at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:890)
> at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:865)
> at com.gargoylesoftware.htmlunit.html.HtmlInput.executeOnChangeHandlerIfAppropriate(HtmlInput.java:469)
> at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:310)
> at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:283)
> at com.gargoylesoftware.htmlunit.html.HtmlOption.setSelected(HtmlOption.java:87)
> at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:264)
> at model.Client.setOptions(Client.java:331)
> at view.GeneralOptions.setOrderOptions(GeneralOptions.java:437)
> at view.GeneralOptions.actionPerformed(GeneralOptions.java:461)
> at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
> at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
> at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
> at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
> at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
> at java.awt.Component.processMouseEvent(Component.java:5517)
> at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
> at java.awt.Component.processEvent(Component.java:5282)
> at java.awt.Container.processEvent(Container.java:1966)
> at java.awt.Component.dispatchEventImpl(Component.java:3984)
> at java.awt.Container.dispatchEventImpl(Container.java:2024)
> at java.awt.Component.dispatchEvent(Component.java:3819)
> at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
> at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
> at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
> at java.awt.Container.dispatchEventImpl(Container.java:2010)
> at java.awt.Window.dispatchEventImpl(Window.java:1791)
> at java.awt.Component.dispatchEvent(Component.java:3819)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
> Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "modelChange" is not defined.
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3772)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3750)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3835)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1829)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2234)
> at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1506)
> at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
> at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
> at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
> at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:269)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3162)
> 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:559)
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:524)
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)
> ... 44 more
> Enclosed exception:
> net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "modelChange" is not defined.
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3772)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3750)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3835)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1829)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2234)
> at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1506)
> at script(onchange event for HtmlSelect[<select name="model" tabindex="8" onchange="interval.value=0; document.forms[0].finished.value='0'; modelChange(this); //submit();">] in http://etis.warley.fordstar.com/csg/checksheet.do)
> at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
> at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
> at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
> at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:269)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3162)
> 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:559)
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:524)
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)
> at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
> at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:531)
> at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:906)
> at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:197)
> at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:216)
> at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:686)
> at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:885)
> at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
> at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
> at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:890)
> at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:865)
> at com.gargoylesoftware.htmlunit.html.HtmlInput.executeOnChangeHandlerIfAppropriate(HtmlInput.java:469)
> at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:310)
> at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:283)
> at com.gargoylesoftware.htmlunit.html.HtmlOption.setSelected(HtmlOption.java:87)
> at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:264)
> at model.Client.setOptions(Client.java:331)
> at view.GeneralOptions.setOrderOptions(GeneralOptions.java:437)
> at view.GeneralOptions.actionPerformed(GeneralOptions.java:461)
> at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
> at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
> at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
> at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
> at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
> at java.awt.Component.processMouseEvent(Component.java:5517)
> at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
> at java.awt.Component.processEvent(Component.java:5282)
> at java.awt.Container.processEvent(Container.java:1966)
> at java.awt.Component.dispatchEventImpl(Component.java:3984)
> at java.awt.Container.dispatchEventImpl(Container.java:2024)
> at java.awt.Component.dispatchEvent(Component.java:3819)
> at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
> at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
> at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
> at java.awt.Container.dispatchEventImpl(Container.java:2010)
> at java.awt.Window.dispatchEventImpl(Window.java:1791)
> at java.awt.Component.dispatchEvent(Component.java:3819)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
> == CALLING JAVASCRIPT ==
> function () {
> [native code, arity=0]
> }
>
> ======= EXCEPTION END ========
>
>
> But that's still not very clear to me.
>
> Sincerely,
> Tobias
> --
> GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 Euro/mtl.!*
> http://portal.gmx.net/de/go/dsl
--
GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 Euro/mtl.!*
http://portal.gmx.net/de/go/dsl

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

Marc Guillemot
In reply to this post by agent0056
Hallo Tobias,

I wouldn't be surprised if the error come from the fact that you don't
enable JS while loading the page. Except if you have very good reasons
for it, you should enable/disable JS *before* loading any page.

--
HtmlUnit support & consulting from the source
Blog: http://mguillem.wordpress.com


On 09/03/2010 06:00 PM, [hidden email] wrote:

> Hi Marc,
>
> you're right, I set setThrowExceptionOnScriptError(false). When I enable it, I get the following exception (JS is enabled AFTER loading this webpage with click() since I even don't get there with JS enabled):
> I had to change my email provider since the old one was refused most times.
>
>
> Exception in thread "AWT-EventQueue-0" ======= EXCEPTION START ========
> EcmaError: lineNumber=[0] column=[0] lineSource=[function () {] name=[ReferenceError] sourceName=[onchange event for HtmlSelect[<select name="model" tabindex="8" onchange="interval.value=0; document.forms[0].finished.value='0'; modelChange(this); //submit();">] in http://etis.warley.fordstar.com/csg/checksheet.do] message=[ReferenceError: "modelChange" is not defined.]
> com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "modelChange" is not defined.
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:601)
> at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
> at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:531)
> at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:906)
> at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:197)
> at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:216)
> at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:686)
> at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:885)
> at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
> at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
> at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:890)
> at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:865)
> at com.gargoylesoftware.htmlunit.html.HtmlInput.executeOnChangeHandlerIfAppropriate(HtmlInput.java:469)
> at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:310)
> at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:283)
> at com.gargoylesoftware.htmlunit.html.HtmlOption.setSelected(HtmlOption.java:87)
> at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:264)
> at model.Client.setOptions(Client.java:331)
> at view.GeneralOptions.setOrderOptions(GeneralOptions.java:437)
> at view.GeneralOptions.actionPerformed(GeneralOptions.java:461)
> at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
> at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
> at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
> at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
> at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
> at java.awt.Component.processMouseEvent(Component.java:5517)
> at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
> at java.awt.Component.processEvent(Component.java:5282)
> at java.awt.Container.processEvent(Container.java:1966)
> at java.awt.Component.dispatchEventImpl(Component.java:3984)
> at java.awt.Container.dispatchEventImpl(Container.java:2024)
> at java.awt.Component.dispatchEvent(Component.java:3819)
> at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
> at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
> at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
> at java.awt.Container.dispatchEventImpl(Container.java:2010)
> at java.awt.Window.dispatchEventImpl(Window.java:1791)
> at java.awt.Component.dispatchEvent(Component.java:3819)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
> Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "modelChange" is not defined.
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3772)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3750)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3835)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1829)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2234)
> at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1506)
> at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
> at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
> at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
> at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:269)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3162)
> 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:559)
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:524)
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)
> ... 44 more
> Enclosed exception:
> net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "modelChange" is not defined.
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3772)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3750)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3835)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1829)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2234)
> at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1506)
> at script(onchange event for HtmlSelect[<select name="model" tabindex="8" onchange="interval.value=0; document.forms[0].finished.value='0'; modelChange(this); //submit();">] in http://etis.warley.fordstar.com/csg/checksheet.do)
> at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
> at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
> at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
> at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:269)
> at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3162)
> 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:559)
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:524)
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)
> at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
> at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
> at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:531)
> at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:906)
> at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:197)
> at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:216)
> at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:686)
> at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:885)
> at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
> at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
> at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:890)
> at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:865)
> at com.gargoylesoftware.htmlunit.html.HtmlInput.executeOnChangeHandlerIfAppropriate(HtmlInput.java:469)
> at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:310)
> at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:283)
> at com.gargoylesoftware.htmlunit.html.HtmlOption.setSelected(HtmlOption.java:87)
> at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:264)
> at model.Client.setOptions(Client.java:331)
> at view.GeneralOptions.setOrderOptions(GeneralOptions.java:437)
> at view.GeneralOptions.actionPerformed(GeneralOptions.java:461)
> at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
> at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
> at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
> at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
> at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
> at java.awt.Component.processMouseEvent(Component.java:5517)
> at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
> at java.awt.Component.processEvent(Component.java:5282)
> at java.awt.Container.processEvent(Container.java:1966)
> at java.awt.Component.dispatchEventImpl(Component.java:3984)
> at java.awt.Container.dispatchEventImpl(Container.java:2024)
> at java.awt.Component.dispatchEvent(Component.java:3819)
> at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
> at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
> at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
> at java.awt.Container.dispatchEventImpl(Container.java:2010)
> at java.awt.Window.dispatchEventImpl(Window.java:1791)
> at java.awt.Component.dispatchEvent(Component.java:3819)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
> == CALLING JAVASCRIPT ==
> function () {
> [native code, arity=0]
> }
>
> ======= EXCEPTION END ========
>
>
> But that's still not very clear to me.
>
> Sincerely,
> Tobias



------------------------------------------------------------------------------
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful,
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance.
http://p.sf.net/sfu/dell-sfdev2dev
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

agent0056
In reply to this post by Tobias G.-2
Hi Marc,

when I enable JS before loading the page, I encounter other problems.
Since I am not into web development, I just comment on what I think about the problem.


First the code from the webpage:
*** CODE ***
<html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
    <head>
        <title>
        Fahrzeugangaben und Checklisten-Optionen
        </title>
        <meta http-equiv="Content-Type" content="text/css; charset=utf-8"/>
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />    
        <link rel="stylesheet" href="/css/common.css" type="text/css" />
        <link rel="stylesheet" href="/css/layout.css" type="text/css" />
        <link rel="stylesheet" href="/tabs/style/nav.css" type="text/css" />
        <script type="text/javascript" src="/js/ajaxUtil.js"></script>
        <script type="text/javascript">
        <!--  to hide script contents from old browsers
            function myNewWindow()
            {
some_new_window=open("/contextualHelp.do?contextualHelpId=Information/h000023","help","top=150,left=450,menubar=no,toolbar=no,scrollbar=yes,scrollbars=yes,resizable=yes,width=450,height=500,status=yes");
            }
        // end hiding contents from old browsers  -->
        </script>
    </head>
    <body onload="serviceOrPretestCheckChange(document.forms[0].service.checked, document.forms[0].preTest.checked);" >
    ...
*** /CODE ***



The exceptions' output is now following as I think this is enough of it (shortened):
*** TWO ERRORS ***
********** ENABLING JS **********
********** CALLING PAGE GENERAL OPTIONS **********
14.09.2010 09:58:34 com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNUNG: Obsolete content type encountered: 'text/javascript'.
14.09.2010 09:58:35 com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine handleJavaScriptException
INFO: Caught script exception
======= EXCEPTION START ========
EcmaError: lineNumber=[0] column=[0] lineSource=[function () {] name=[ReferenceError] sourceName=[onload event for HtmlBody[<body onload="serviceOrPretestCheckChange(document.forms[0].service.checked, document.forms[0].preTest.checked);">] in http://etis.warley.fordstar.com/csg/checksheet.do] message=[ReferenceError: "serviceOrPretestCheckChange" is not defined.]
com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "serviceOrPretestCheckChange" is not defined.
        at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:601)
        at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
        at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
...
Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "serviceOrPretestCheckChange" is not defined.
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3772)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3750)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3835)
...
Enclosed exception:
net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "serviceOrPretestCheckChange" is not defined.
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3772)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3750)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3835)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1829)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2234)
        at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1506)
        at script(onload event for HtmlBody[<body onload="serviceOrPretestCheckChange(document.forms[0].service.checked, document.forms[0].preTest.checked);">] in http://etis.warley.fordstar.com/csg/checksheet.do)
        at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
        at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
...
== CALLING JAVASCRIPT ==
function () {
        [native code, arity=0]
}
======= EXCEPTION END ========

********** CLICK ON OK IN GENERAL OPTIONS **********
14.09.2010 09:58:46 com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine handleJavaScriptException
INFO: Caught script exception
======= EXCEPTION START ========
EcmaError: lineNumber=[0] column=[0] lineSource=[function () {] name=[ReferenceError] sourceName=[onload event for HtmlBody[<body onload="serviceOrPretestCheckChange(document.forms[0].service.checked, document.forms[0].preTest.checked);">] in http://etis.warley.fordstar.com/csg/checksheetOptionsUpdate.do] message=[ReferenceError: "serviceOrPretestCheckChange" is not defined.]
com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "serviceOrPretestCheckChange" is not defined.
        at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:601)
...
== CALLING JAVASCRIPT ==
function () {
        [native code, arity=0]
}
======= EXCEPTION END ========
*** /TWO ERRORS ***



There are two exceptions: one when loading the page and one when clicking th OK-button to proceed to the next page. Both exceptions are the same.
So that means, that the onload event does not work. Other events like clicking on the OK-button don't work neither (anymore), so that with enabled JS I cannot finish my whole request (see second exception).
Where do I have to look for the function "serviceOrPretestCheckChange"? It does not show up in the normal browser's web sources.

The page is http://etis.warley.fordstar.com/csg/checksheet.do
The script called in the web page head:
<script type="text/javascript" src="/js/ajaxUtil.js"></script>
is not under http://etis.warley.fordstar.com/csg/js/ajaxUtil.js
but under http://etis.warley.fordstar.com/js/ajaxUtil.js.
Is that important? Since the script does not contain the function "serviceOrPretestCheckChange".

Other things to mention:
- I got some CSS errors, but I don't think that's important.

- A few pages before I get to the error, the following warning appears (but it's not from the page where I have problems with):
14.09.2010 10:36:17 com.gargoylesoftware.htmlunit.html.HtmlScript isExecutionNeeded
WARNUNG: Script is not JavaScript (type: text/vbscript, language: vbscript). Skipping execution.

- When I enable setThrowExceptionOnScriptError() I just get the first exception and then the program ends. But since the second exception is the same (when clicking on OK), I think this is not important as well.


I'm totally stuck.

Greetings,


Tobias



Am 10.09.2010 16:18, schrieb Marc Guillemot:

> Hallo Tobias,
>
> I wouldn't be surprised if the error come from the fact that you don't
> enable JS while loading the page. Except if you have very good reasons
> for it, you should enable/disable JS *before* loading any page.
>
> -- HtmlUnit support & consulting from the source Blog: http://mguillem.wordpress.com On 09/03/2010 06:00 PM, [hidden email] wrote:
>> > Hi Marc,
>> >
>> > you're right, I set setThrowExceptionOnScriptError(false). When I enable it, I get the following exception (JS is enabled AFTER loading this webpage with click() since I even don't get there with JS enabled):
>> > I had to change my email provider since the old one was refused most times.
>> >
>> >
>> > Exception in thread "AWT-EventQueue-0" ======= EXCEPTION START ========
>> > EcmaError: lineNumber=[0] column=[0] lineSource=[function () {] name=[ReferenceError] sourceName=[onchange event for HtmlSelect[<select name="model" tabindex="8" onchange="interval.value=0; document.forms[0].finished.value='0'; modelChange(this); //submit();">] in http://etis.warley.fordstar.com/csg/checksheet.do] message=[ReferenceError: "modelChange" is not defined.]
>> > com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "modelChange" is not defined.
>> > at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:601)
>> > at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
>> > at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
>> > at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:531)
>> > at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:906)
>> > at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:197)
>> > at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:216)
>> > at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:686)
>> > at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:885)
>> > at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
>> > at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
>> > at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:890)
>> > at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:865)
>> > at com.gargoylesoftware.htmlunit.html.HtmlInput.executeOnChangeHandlerIfAppropriate(HtmlInput.java:469)
>> > at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:310)
>> > at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:283)
>> > at com.gargoylesoftware.htmlunit.html.HtmlOption.setSelected(HtmlOption.java:87)
>> > at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:264)
>> > at model.Client.setOptions(Client.java:331)
>> > at view.GeneralOptions.setOrderOptions(GeneralOptions.java:437)
>> > at view.GeneralOptions.actionPerformed(GeneralOptions.java:461)
>> > at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
>> > at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
>> > at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
>> > at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
>> > at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
>> > at java.awt.Component.processMouseEvent(Component.java:5517)
>> > at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
>> > at java.awt.Component.processEvent(Component.java:5282)
>> > at java.awt.Container.processEvent(Container.java:1966)
>> > at java.awt.Component.dispatchEventImpl(Component.java:3984)
>> > at java.awt.Container.dispatchEventImpl(Container.java:2024)
>> > at java.awt.Component.dispatchEvent(Component.java:3819)
>> > at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
>> > at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
>> > at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
>> > at java.awt.Container.dispatchEventImpl(Container.java:2010)
>> > at java.awt.Window.dispatchEventImpl(Window.java:1791)
>> > at java.awt.Component.dispatchEvent(Component.java:3819)
>> > at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
>> > at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
>> > at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
>> > at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
>> > at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
>> > at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
>> > Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "modelChange" is not defined.
>> > at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3772)
>> > at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3750)
>> > at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3835)
>> > at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1829)
>> > at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2234)
>> > at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1506)
>> > at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
>> > at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
>> > at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
>> > at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:269)
>> > at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3162)
>> > 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:559)
>> > at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:524)
>> > at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)
>> > ... 44 more
>> > Enclosed exception:
>> > net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "modelChange" is not defined.
>> > at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3772)
>> > at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3750)
>> > at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3835)
>> > at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1829)
>> > at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2234)
>> > at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1506)
>> > at script(onchange event for HtmlSelect[<select name="model" tabindex="8" onchange="interval.value=0; document.forms[0].finished.value='0'; modelChange(this); //submit();">] in http://etis.warley.fordstar.com/csg/checksheet.do)
>> > at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
>> > at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
>> > at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
>> > at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:269)
>> > at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3162)
>> > 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:559)
>> > at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:524)
>> > at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)
>> > at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
>> > at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
>> > at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:531)
>> > at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:906)
>> > at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:197)
>> > at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:216)
>> > at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:686)
>> > at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:885)
>> > at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
>> > at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
>> > at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:890)
>> > at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:865)
>> > at com.gargoylesoftware.htmlunit.html.HtmlInput.executeOnChangeHandlerIfAppropriate(HtmlInput.java:469)
>> > at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:310)
>> > at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:283)
>> > at com.gargoylesoftware.htmlunit.html.HtmlOption.setSelected(HtmlOption.java:87)
>> > at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:264)
>> > at model.Client.setOptions(Client.java:331)
>> > at view.GeneralOptions.setOrderOptions(GeneralOptions.java:437)
>> > at view.GeneralOptions.actionPerformed(GeneralOptions.java:461)
>> > at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
>> > at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
>> > at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
>> > at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
>> > at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
>> > at java.awt.Component.processMouseEvent(Component.java:5517)
>> > at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
>> > at java.awt.Component.processEvent(Component.java:5282)
>> > at java.awt.Container.processEvent(Container.java:1966)
>> > at java.awt.Component.dispatchEventImpl(Component.java:3984)
>> > at java.awt.Container.dispatchEventImpl(Container.java:2024)
>> > at java.awt.Component.dispatchEvent(Component.java:3819)
>> > at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
>> > at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
>> > at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
>> > at java.awt.Container.dispatchEventImpl(Container.java:2010)
>> > at java.awt.Window.dispatchEventImpl(Window.java:1791)
>> > at java.awt.Component.dispatchEvent(Component.java:3819)
>> > at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
>> > at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
>> > at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
>> > at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
>> > at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
>> > at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
>> > == CALLING JAVASCRIPT ==
>> > function () {
>> > [native code, arity=0]
>> > }
>> >
>> > ======= EXCEPTION END ========
>> >
>> >
>> > But that's still not very clear to me.
>> >
>> > Sincerely,
>> > Tobias
--
GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
Jetzt freischalten! http://portal.gmx.net/de/go/maxdome

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

Marc Guillemot
Hallo Tobias,

...

>
> There are two exceptions: one when loading the page and one when clicking th OK-button to proceed to the next page. Both exceptions are the same.
> So that means, that the onload event does not work. Other events like clicking on the OK-button don't work neither (anymore), so that with enabled JS I cannot finish my whole request (see second exception).
> Where do I have to look for the function "serviceOrPretestCheckChange"? It does not show up in the normal browser's web sources.

probably in some js file?

> The page is http://etis.warley.fordstar.com/csg/checksheet.do
> The script called in the web page head:
> <script type="text/javascript" src="/js/ajaxUtil.js"></script>
> is not under http://etis.warley.fordstar.com/csg/js/ajaxUtil.js
> but under http://etis.warley.fordstar.com/js/ajaxUtil.js.

if src="/js/ajaxUtil.js" then it means that the browser should get it
from http://etis.warley.fordstar.com/js/ajaxUtil.js

> Is that important? Since the script does not contain the function "serviceOrPretestCheckChange".

no idea if this is important in this case but if HtmlUnit behaves
differently here than the simulated browser, then it may be the cause of
the problem.

> Other things to mention:
> - I got some CSS errors, but I don't think that's important.

I agree. Most of the CSS errors are probably errors of the CSS parser.

> - A few pages before I get to the error, the following warning appears (but it's not from the page where I have problems with):
> 14.09.2010 10:36:17 com.gargoylesoftware.htmlunit.html.HtmlScript isExecutionNeeded
> WARNUNG: Script is not JavaScript (type: text/vbscript, language: vbscript). Skipping execution.

this may be the root of the problem. If some functions are defined in
vbscript, then HtmlUnit won't be able to find them later.
A solution would be to simulate Firefox rather than IE.

> - When I enable setThrowExceptionOnScriptError() I just get the first exception and then the program ends. But since the second exception is the same (when clicking on OK),
 > I think this is not important as well.
>
> I'm totally stuck.

:-(
if you want more help than the one I can provide here, I provide
professional support too.

Cheers,
Marc.
--
HtmlUnit support & consulting from the source
Blog: http://mguillem.wordpress.com


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

agent0056
In reply to this post by Tobias G.-2
Hi Marc,

thanks for your effort to help me.

- I don't find a JS file with the function "serviceOrPretestCheckChange" and I don't have access to the web page. I can just see what the browser sees and there is no hint to another file except js/ajaxUtil.js which does not contain this function.
I probably will contact the author (hopefully next week) trying to find an answer for this "missing" function.

- I just changed a little code for using FF3.6, but FF can't execute this vbscript neither. But I think it's not important since there only seems to be VB on the login page, that does not matter later on. I used IE from the beginning on since the site owner officially supports IE up to v7 and no other browses. Furthermore there seem to be other problems after switching to FF. Do your FF and IE implementations use different JS engines?

- Just discovered another warning I missed last time. It comes up when I load the "faulty" page (just before the exception about the missing function).
com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNUNG: Obsolete content type encountered: 'text/javascript'.


So I think that this "missing" function is my real problem.
Where else could I have a look at to find it? IMHO browsers can't "store" JS from other pages and use it when they want to or "guess" a path to a JS file. But the function does not appear if I let me show the source code from IE / FF / whatever.


I'm just a student trying to get a project to work by "misusing" HtmlUnit as a browser in background to download some files (whick works very well, except the JS functions don't), since I don't see any other options for this task and HtmlUnit seems to be really great. So I don't know how your professional support works, but I for myself can't put money in this project although I really, really appreciate your help.


Best regards,

Tobias



-------- Original-Nachricht --------
> Datum: Fri, 17 Sep 2010 08:51:55 +0200
> Von: Marc Guillemot <[hidden email]>
> An: [hidden email]
> Betreff: Re: [Htmlunit-user] Problem executing JS

> Hallo Tobias,
>
> ...
>
> >
> > There are two exceptions: one when loading the page and one when
> clicking th OK-button to proceed to the next page. Both exceptions are the same.
> > So that means, that the onload event does not work. Other events like
> clicking on the OK-button don't work neither (anymore), so that with enabled
> JS I cannot finish my whole request (see second exception).
> > Where do I have to look for the function "serviceOrPretestCheckChange"?
> It does not show up in the normal browser's web sources.
>
> probably in some js file?
>
> > The page is http://etis.warley.fordstar.com/csg/checksheet.do
> > The script called in the web page head:
> > <script type="text/javascript" src="/js/ajaxUtil.js"></script>
> > is not under http://etis.warley.fordstar.com/csg/js/ajaxUtil.js
> > but under http://etis.warley.fordstar.com/js/ajaxUtil.js.
>
> if src="/js/ajaxUtil.js" then it means that the browser should get it
> from http://etis.warley.fordstar.com/js/ajaxUtil.js
>
> > Is that important? Since the script does not contain the function
> "serviceOrPretestCheckChange".
>
> no idea if this is important in this case but if HtmlUnit behaves
> differently here than the simulated browser, then it may be the cause of
> the problem.
>
> > Other things to mention:
> > - I got some CSS errors, but I don't think that's important.
>
> I agree. Most of the CSS errors are probably errors of the CSS parser.
>
> > - A few pages before I get to the error, the following warning appears
> (but it's not from the page where I have problems with):
> > 14.09.2010 10:36:17 com.gargoylesoftware.htmlunit.html.HtmlScript
> isExecutionNeeded
> > WARNUNG: Script is not JavaScript (type: text/vbscript, language:
> vbscript). Skipping execution.
>
> this may be the root of the problem. If some functions are defined in
> vbscript, then HtmlUnit won't be able to find them later.
> A solution would be to simulate Firefox rather than IE.
>
> > - When I enable setThrowExceptionOnScriptError() I just get the first
> exception and then the program ends. But since the second exception is the
> same (when clicking on OK),
>  > I think this is not important as well.
> >
> > I'm totally stuck.
>
> :-(
> if you want more help than the one I can provide here, I provide
> professional support too.
>
> Cheers,
> Marc.
> --
> HtmlUnit support & consulting from the source
> Blog: http://mguillem.wordpress.com
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Htmlunit-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/htmlunit-user


--
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

Justin Cummins


On Fri, Sep 17, 2010 at 4:14 AM, Tobias Groch <[hidden email]> wrote:
- I just changed a little code for using FF3.6, but FF can't execute this vbscript neither. But I think it's not important since there only seems to be VB on the login page, that does not matter later on. I used IE from the beginning on since the site owner officially supports IE up to v7 and no other browses. Furthermore there seem to be other problems after switching to FF. Do your FF and IE implementations use different JS engines?

Wow, I know it's not your site, but I cringe to think its "optimized for IE". :) No, all BrowserVersions use Rhino as the JS engine, but the data fed to Rhino may be different.
 
- Just discovered another warning I missed last time. It comes up when I load the "faulty" page (just before the exception about the missing function).
com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNUNG: Obsolete content type encountered: 'text/javascript'.

You can ignore this. "text/javascript" was officially deprecated, however its the only reliable type to use. "application/javascript" doesn't work everywhere.
 
I'm just a student trying to get a project to work by "misusing" HtmlUnit as a browser in background to download some files (whick works very well, except the JS functions don't), since I don't see any other options for this task and HtmlUnit seems to be really great. So I don't know how your professional support works, but I for myself can't put money in this project although I really, really appreciate your help.

There are some sites that don't work under HtmlUnit. If all you're really doing is downloading content take a look at WebDriver. You can use the HtmlUnit driver most of the time but swap in any other browser for sites you have problems with. 

~Justin



-------- Original-Nachricht --------
> Datum: Fri, 17 Sep 2010 08:51:55 +0200
> Von: Marc Guillemot <[hidden email]>
> An: [hidden email]
> Betreff: Re: [Htmlunit-user] Problem executing JS

> Hallo Tobias,
>
> ...
>
> >
> > There are two exceptions: one when loading the page and one when
> clicking th OK-button to proceed to the next page. Both exceptions are the same.
> > So that means, that the onload event does not work. Other events like
> clicking on the OK-button don't work neither (anymore), so that with enabled
> JS I cannot finish my whole request (see second exception).
> > Where do I have to look for the function "serviceOrPretestCheckChange"?
> It does not show up in the normal browser's web sources.
>
> probably in some js file?
>
> > The page is http://etis.warley.fordstar.com/csg/checksheet.do
> > The script called in the web page head:
> > <script type="text/javascript" src="/js/ajaxUtil.js"></script>
> > is not under http://etis.warley.fordstar.com/csg/js/ajaxUtil.js
> > but under http://etis.warley.fordstar.com/js/ajaxUtil.js.
>
> if src="/js/ajaxUtil.js" then it means that the browser should get it
> from http://etis.warley.fordstar.com/js/ajaxUtil.js
>
> > Is that important? Since the script does not contain the function
> "serviceOrPretestCheckChange".
>
> no idea if this is important in this case but if HtmlUnit behaves
> differently here than the simulated browser, then it may be the cause of
> the problem.
>
> > Other things to mention:
> > - I got some CSS errors, but I don't think that's important.
>
> I agree. Most of the CSS errors are probably errors of the CSS parser.
>
> > - A few pages before I get to the error, the following warning appears
> (but it's not from the page where I have problems with):
> > 14.09.2010 10:36:17 com.gargoylesoftware.htmlunit.html.HtmlScript
> isExecutionNeeded
> > WARNUNG: Script is not JavaScript (type: text/vbscript, language:
> vbscript). Skipping execution.
>
> this may be the root of the problem. If some functions are defined in
> vbscript, then HtmlUnit won't be able to find them later.
> A solution would be to simulate Firefox rather than IE.
>
> > - When I enable setThrowExceptionOnScriptError() I just get the first
> exception and then the program ends. But since the second exception is the
> same (when clicking on OK),
>  > I think this is not important as well.
> >
> > I'm totally stuck.
>
> :-(
> if you want more help than the one I can provide here, I provide
> professional support too.
>
> Cheers,
> Marc.
> --
> HtmlUnit support & consulting from the source
> Blog: http://mguillem.wordpress.com
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Htmlunit-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/htmlunit-user


--
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

agent0056
Hi Justin,

thanks for the information.
Well, I am not just downloading files. I "configure" them beforehand and this needs to execute JS. But it seems that InternetExplorerWebDriver is the thing I really need for that, although everything should work in HtmlUnit theoretically.
I'll give the WebDriver a try on that specific page. But there's one question now.

How will I be able to "transfer" my browser session from HtmlUnit (I am logged in from the first page on) to InternetExplorerWebDriver? Please don't say I have to code from scratch...

Thank you very much.

Best regards

Tobias


-------- Original-Nachricht --------
> Datum: Sat, 18 Sep 2010 09:08:33 -0700
> Von: Justin Cummins <[hidden email]>
> An: [hidden email]
> Betreff: Re: [Htmlunit-user] Problem executing JS

> On Fri, Sep 17, 2010 at 4:14 AM, Tobias Groch <[hidden email]> wrote:
>
> > - I just changed a little code for using FF3.6, but FF can't execute
> this
> > vbscript neither. But I think it's not important since there only seems
> to
> > be VB on the login page, that does not matter later on. I used IE from
> the
> > beginning on since the site owner officially supports IE up to v7 and no
> > other browses. Furthermore there seem to be other problems after
> switching
> > to FF. Do your FF and IE implementations use different JS engines?
> >
>
> Wow, I know it's not your site, but I cringe to think its "optimized for
> IE". :) No, all BrowserVersions use Rhino as the JS engine, but the data
> fed
> to Rhino may be different.
>
>
> > - Just discovered another warning I missed last time. It comes up when I
> > load the "faulty" page (just before the exception about the missing
> > function).
> > com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
> > WARNUNG: Obsolete content type encountered: 'text/javascript'.
> >
>
> You can ignore this. "text/javascript" was officially deprecated, however
> its the only reliable type to use. "application/javascript" doesn't work
> everywhere.
>
>
> > I'm just a student trying to get a project to work by "misusing"
> HtmlUnit
> > as a browser in background to download some files (whick works very
> well,
> > except the JS functions don't), since I don't see any other options for
> this
> > task and HtmlUnit seems to be really great. So I don't know how your
> > professional support works, but I for myself can't put money in this
> project
> > although I really, really appreciate your help.
> >
>
> There are some sites that don't work under HtmlUnit. If all you're really
> doing is downloading content take a look at WebDriver. You can use the
> HtmlUnit driver most of the time but swap in any other browser for sites
> you
> have problems with.
>
> ~Justin
>
>
> >
> > -------- Original-Nachricht --------
> > > Datum: Fri, 17 Sep 2010 08:51:55 +0200
> > > Von: Marc Guillemot <[hidden email]>
> > > An: [hidden email]
> > > Betreff: Re: [Htmlunit-user] Problem executing JS
> >
> > > Hallo Tobias,
> > >
> > > ...
> > >
> > > >
> > > > There are two exceptions: one when loading the page and one when
> > > clicking th OK-button to proceed to the next page. Both exceptions are
> > the same.
> > > > So that means, that the onload event does not work. Other events
> like
> > > clicking on the OK-button don't work neither (anymore), so that with
> > enabled
> > > JS I cannot finish my whole request (see second exception).
> > > > Where do I have to look for the function
> "serviceOrPretestCheckChange"?
> > > It does not show up in the normal browser's web sources.
> > >
> > > probably in some js file?
> > >
> > > > The page is http://etis.warley.fordstar.com/csg/checksheet.do
> > > > The script called in the web page head:
> > > > <script type="text/javascript" src="/js/ajaxUtil.js"></script>
> > > > is not under http://etis.warley.fordstar.com/csg/js/ajaxUtil.js
> > > > but under http://etis.warley.fordstar.com/js/ajaxUtil.js.
> > >
> > > if src="/js/ajaxUtil.js" then it means that the browser should get it
> > > from http://etis.warley.fordstar.com/js/ajaxUtil.js
> > >
> > > > Is that important? Since the script does not contain the function
> > > "serviceOrPretestCheckChange".
> > >
> > > no idea if this is important in this case but if HtmlUnit behaves
> > > differently here than the simulated browser, then it may be the cause
> of
> > > the problem.
> > >
> > > > Other things to mention:
> > > > - I got some CSS errors, but I don't think that's important.
> > >
> > > I agree. Most of the CSS errors are probably errors of the CSS parser.
> > >
> > > > - A few pages before I get to the error, the following warning
> appears
> > > (but it's not from the page where I have problems with):
> > > > 14.09.2010 10:36:17 com.gargoylesoftware.htmlunit.html.HtmlScript
> > > isExecutionNeeded
> > > > WARNUNG: Script is not JavaScript (type: text/vbscript, language:
> > > vbscript). Skipping execution.
> > >
> > > this may be the root of the problem. If some functions are defined in
> > > vbscript, then HtmlUnit won't be able to find them later.
> > > A solution would be to simulate Firefox rather than IE.
> > >
> > > > - When I enable setThrowExceptionOnScriptError() I just get the
> first
> > > exception and then the program ends. But since the second exception is
> > the
> > > same (when clicking on OK),
> > >  > I think this is not important as well.
> > > >
> > > > I'm totally stuck.
> > >
> > > :-(
> > > if you want more help than the one I can provide here, I provide
> > > professional support too.
> > >
> > > Cheers,
> > > Marc.
> > > --
> > > HtmlUnit support & consulting from the source
> > > Blog: http://mguillem.wordpress.com
> > >
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > > Start uncovering the many advantages of virtual appliances
> > > and start using them to simplify application deployment and
> > > accelerate your shift to cloud computing.
> > > http://p.sf.net/sfu/novell-sfdev2dev
> > > _______________________________________________
> > > Htmlunit-user mailing list
> > > [hidden email]
> > > https://lists.sourceforge.net/lists/listinfo/htmlunit-user
> >
> >
> > --
> > Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
> > Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
> >
> >
> >
> ------------------------------------------------------------------------------
> > Start uncovering the many advantages of virtual appliances
> > and start using them to simplify application deployment and
> > accelerate your shift to cloud computing.
> > http://p.sf.net/sfu/novell-sfdev2dev
> > _______________________________________________
> > Htmlunit-user mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/htmlunit-user
> >

--
GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 Euro/mtl.!*
http://portal.gmx.net/de/go/dsl

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

Justin Cummins
Hi Tobias,

I'm not a webDriver pro, but the safest way would be to write it again yes, although I don't think the API will be trouble for you. You might be able to transfer the session depending on how the webserver/site authenticate you. If all that's needed is a session cookie, you can extract it from HtmlUnit and insert it into your webDriver request. Again, though, I'd bet writing the webDriver login code would be faster.

~Justin

On Sun, Sep 19, 2010 at 10:48 PM, Tobias Groch <[hidden email]> wrote:
Hi Justin,

thanks for the information.
Well, I am not just downloading files. I "configure" them beforehand and this needs to execute JS. But it seems that InternetExplorerWebDriver is the thing I really need for that, although everything should work in HtmlUnit theoretically.
I'll give the WebDriver a try on that specific page. But there's one question now.

How will I be able to "transfer" my browser session from HtmlUnit (I am logged in from the first page on) to InternetExplorerWebDriver? Please don't say I have to code from scratch...

Thank you very much.

Best regards

Tobias


-------- Original-Nachricht --------
> Datum: Sat, 18 Sep 2010 09:08:33 -0700
> Von: Justin Cummins <[hidden email]>
> An: [hidden email]
> Betreff: Re: [Htmlunit-user] Problem executing JS

> On Fri, Sep 17, 2010 at 4:14 AM, Tobias Groch <[hidden email]> wrote:
>
> > - I just changed a little code for using FF3.6, but FF can't execute
> this
> > vbscript neither. But I think it's not important since there only seems
> to
> > be VB on the login page, that does not matter later on. I used IE from
> the
> > beginning on since the site owner officially supports IE up to v7 and no
> > other browses. Furthermore there seem to be other problems after
> switching
> > to FF. Do your FF and IE implementations use different JS engines?
> >
>
> Wow, I know it's not your site, but I cringe to think its "optimized for
> IE". :) No, all BrowserVersions use Rhino as the JS engine, but the data
> fed
> to Rhino may be different.
>
>
> > - Just discovered another warning I missed last time. It comes up when I
> > load the "faulty" page (just before the exception about the missing
> > function).
> > com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
> > WARNUNG: Obsolete content type encountered: 'text/javascript'.
> >
>
> You can ignore this. "text/javascript" was officially deprecated, however
> its the only reliable type to use. "application/javascript" doesn't work
> everywhere.
>
>
> > I'm just a student trying to get a project to work by "misusing"
> HtmlUnit
> > as a browser in background to download some files (whick works very
> well,
> > except the JS functions don't), since I don't see any other options for
> this
> > task and HtmlUnit seems to be really great. So I don't know how your
> > professional support works, but I for myself can't put money in this
> project
> > although I really, really appreciate your help.
> >
>
> There are some sites that don't work under HtmlUnit. If all you're really
> doing is downloading content take a look at WebDriver. You can use the
> HtmlUnit driver most of the time but swap in any other browser for sites
> you
> have problems with.
>
> ~Justin
>
>
> >
> > -------- Original-Nachricht --------
> > > Datum: Fri, 17 Sep 2010 08:51:55 +0200
> > > Von: Marc Guillemot <[hidden email]>
> > > An: [hidden email]
> > > Betreff: Re: [Htmlunit-user] Problem executing JS
> >
> > > Hallo Tobias,
> > >
> > > ...
> > >
> > > >
> > > > There are two exceptions: one when loading the page and one when
> > > clicking th OK-button to proceed to the next page. Both exceptions are
> > the same.
> > > > So that means, that the onload event does not work. Other events
> like
> > > clicking on the OK-button don't work neither (anymore), so that with
> > enabled
> > > JS I cannot finish my whole request (see second exception).
> > > > Where do I have to look for the function
> "serviceOrPretestCheckChange"?
> > > It does not show up in the normal browser's web sources.
> > >
> > > probably in some js file?
> > >
> > > > The page is http://etis.warley.fordstar.com/csg/checksheet.do
> > > > The script called in the web page head:
> > > > <script type="text/javascript" src="/js/ajaxUtil.js"></script>
> > > > is not under http://etis.warley.fordstar.com/csg/js/ajaxUtil.js
> > > > but under http://etis.warley.fordstar.com/js/ajaxUtil.js.
> > >
> > > if src="/js/ajaxUtil.js" then it means that the browser should get it
> > > from http://etis.warley.fordstar.com/js/ajaxUtil.js
> > >
> > > > Is that important? Since the script does not contain the function
> > > "serviceOrPretestCheckChange".
> > >
> > > no idea if this is important in this case but if HtmlUnit behaves
> > > differently here than the simulated browser, then it may be the cause
> of
> > > the problem.
> > >
> > > > Other things to mention:
> > > > - I got some CSS errors, but I don't think that's important.
> > >
> > > I agree. Most of the CSS errors are probably errors of the CSS parser.
> > >
> > > > - A few pages before I get to the error, the following warning
> appears
> > > (but it's not from the page where I have problems with):
> > > > 14.09.2010 10:36:17 com.gargoylesoftware.htmlunit.html.HtmlScript
> > > isExecutionNeeded
> > > > WARNUNG: Script is not JavaScript (type: text/vbscript, language:
> > > vbscript). Skipping execution.
> > >
> > > this may be the root of the problem. If some functions are defined in
> > > vbscript, then HtmlUnit won't be able to find them later.
> > > A solution would be to simulate Firefox rather than IE.
> > >
> > > > - When I enable setThrowExceptionOnScriptError() I just get the
> first
> > > exception and then the program ends. But since the second exception is
> > the
> > > same (when clicking on OK),
> > >  > I think this is not important as well.
> > > >
> > > > I'm totally stuck.
> > >
> > > :-(
> > > if you want more help than the one I can provide here, I provide
> > > professional support too.
> > >
> > > Cheers,
> > > Marc.
> > > --
> > > HtmlUnit support & consulting from the source
> > > Blog: http://mguillem.wordpress.com
> > >
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > > Start uncovering the many advantages of virtual appliances
> > > and start using them to simplify application deployment and
> > > accelerate your shift to cloud computing.
> > > http://p.sf.net/sfu/novell-sfdev2dev
> > > _______________________________________________
> > > Htmlunit-user mailing list
> > > [hidden email]
> > > https://lists.sourceforge.net/lists/listinfo/htmlunit-user
> >
> >
> > --
> > Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
> > Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
> >
> >
> >
> ------------------------------------------------------------------------------
> > Start uncovering the many advantages of virtual appliances
> > and start using them to simplify application deployment and
> > accelerate your shift to cloud computing.
> > http://p.sf.net/sfu/novell-sfdev2dev
> > _______________________________________________
> > Htmlunit-user mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/htmlunit-user
> >

--
GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 Euro/mtl.!*
http://portal.gmx.net/de/go/dsl

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

agent0056
Hi again,

I tried the WebDriver, but it isn't working as well as HtmlUnit. First of all, it closes all other, manually opened, IE windows at start which is a no-go for me. Handling Check- & Selectboxes is hard (or I am doing it wrong). I know it's an alpha and it's a great project, but it won't help me a lot.
So I am stuck again.

I will hopefully have contact to the web site author soon to get the JS problem with HtmlUnit working.

Regards,

Tobias


-------- Original-Nachricht --------
> Datum: Mon, 20 Sep 2010 00:14:35 -0700
> Von: Justin Cummins <[hidden email]>
> An: [hidden email]
> Betreff: Re: [Htmlunit-user] Problem executing JS

> Hi Tobias,
>
> I'm not a webDriver pro, but the safest way would be to write it again
> yes,
> although I don't think the API will be trouble for you. You might be able
> to
> transfer the session depending on how the webserver/site authenticate you.
> If all that's needed is a session cookie, you can extract it from HtmlUnit
> and insert it into your webDriver request. Again, though, I'd bet writing
> the webDriver login code would be faster.
>
> ~Justin
>
> On Sun, Sep 19, 2010 at 10:48 PM, Tobias Groch <[hidden email]> wrote:
>
> > Hi Justin,
> >
> > thanks for the information.
> > Well, I am not just downloading files. I "configure" them beforehand and
> > this needs to execute JS. But it seems that InternetExplorerWebDriver is
> the
> > thing I really need for that, although everything should work in
> HtmlUnit
> > theoretically.
> > I'll give the WebDriver a try on that specific page. But there's one
> > question now.
> >
> > How will I be able to "transfer" my browser session from HtmlUnit (I am
> > logged in from the first page on) to InternetExplorerWebDriver? Please
> don't
> > say I have to code from scratch...
> >
> > Thank you very much.
> >
> > Best regards
> >
> > Tobias
> >
> >
> > -------- Original-Nachricht --------
> > > Datum: Sat, 18 Sep 2010 09:08:33 -0700
> > > Von: Justin Cummins <[hidden email]>
> > > An: [hidden email]
> > > Betreff: Re: [Htmlunit-user] Problem executing JS
> >
> > > On Fri, Sep 17, 2010 at 4:14 AM, Tobias Groch <[hidden email]>
> wrote:
> > >
> > > > - I just changed a little code for using FF3.6, but FF can't execute
> > > this
> > > > vbscript neither. But I think it's not important since there only
> seems
> > > to
> > > > be VB on the login page, that does not matter later on. I used IE
> from
> > > the
> > > > beginning on since the site owner officially supports IE up to v7
> and
> > no
> > > > other browses. Furthermore there seem to be other problems after
> > > switching
> > > > to FF. Do your FF and IE implementations use different JS engines?
> > > >
> > >
> > > Wow, I know it's not your site, but I cringe to think its "optimized
> for
> > > IE". :) No, all BrowserVersions use Rhino as the JS engine, but the
> data
> > > fed
> > > to Rhino may be different.
> > >
> > >
> > > > - Just discovered another warning I missed last time. It comes up
> when
> > I
> > > > load the "faulty" page (just before the exception about the missing
> > > > function).
> > > > com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
> > > > WARNUNG: Obsolete content type encountered: 'text/javascript'.
> > > >
> > >
> > > You can ignore this. "text/javascript" was officially deprecated,
> however
> > > its the only reliable type to use. "application/javascript" doesn't
> work
> > > everywhere.
> > >
> > >
> > > > I'm just a student trying to get a project to work by "misusing"
> > > HtmlUnit
> > > > as a browser in background to download some files (whick works very
> > > well,
> > > > except the JS functions don't), since I don't see any other options
> for
> > > this
> > > > task and HtmlUnit seems to be really great. So I don't know how your
> > > > professional support works, but I for myself can't put money in this
> > > project
> > > > although I really, really appreciate your help.
> > > >
> > >
> > > There are some sites that don't work under HtmlUnit. If all you're
> really
> > > doing is downloading content take a look at WebDriver. You can use the
> > > HtmlUnit driver most of the time but swap in any other browser for
> sites
> > > you
> > > have problems with.
> > >
> > > ~Justin
> > >
> > >
> > > >
> > > > -------- Original-Nachricht --------
> > > > > Datum: Fri, 17 Sep 2010 08:51:55 +0200
> > > > > Von: Marc Guillemot <[hidden email]>
> > > > > An: [hidden email]
> > > > > Betreff: Re: [Htmlunit-user] Problem executing JS
> > > >
> > > > > Hallo Tobias,
> > > > >
> > > > > ...
> > > > >
> > > > > >
> > > > > > There are two exceptions: one when loading the page and one when
> > > > > clicking th OK-button to proceed to the next page. Both exceptions
> > are
> > > > the same.
> > > > > > So that means, that the onload event does not work. Other events
> > > like
> > > > > clicking on the OK-button don't work neither (anymore), so that
> with
> > > > enabled
> > > > > JS I cannot finish my whole request (see second exception).
> > > > > > Where do I have to look for the function
> > > "serviceOrPretestCheckChange"?
> > > > > It does not show up in the normal browser's web sources.
> > > > >
> > > > > probably in some js file?
> > > > >
> > > > > > The page is http://etis.warley.fordstar.com/csg/checksheet.do
> > > > > > The script called in the web page head:
> > > > > > <script type="text/javascript" src="/js/ajaxUtil.js"></script>
> > > > > > is not under http://etis.warley.fordstar.com/csg/js/ajaxUtil.js
> > > > > > but under http://etis.warley.fordstar.com/js/ajaxUtil.js.
> > > > >
> > > > > if src="/js/ajaxUtil.js" then it means that the browser should get
> it
> > > > > from http://etis.warley.fordstar.com/js/ajaxUtil.js
> > > > >
> > > > > > Is that important? Since the script does not contain the
> function
> > > > > "serviceOrPretestCheckChange".
> > > > >
> > > > > no idea if this is important in this case but if HtmlUnit behaves
> > > > > differently here than the simulated browser, then it may be the
> cause
> > > of
> > > > > the problem.
> > > > >
> > > > > > Other things to mention:
> > > > > > - I got some CSS errors, but I don't think that's important.
> > > > >
> > > > > I agree. Most of the CSS errors are probably errors of the CSS
> > parser.
> > > > >
> > > > > > - A few pages before I get to the error, the following warning
> > > appears
> > > > > (but it's not from the page where I have problems with):
> > > > > > 14.09.2010 10:36:17
> com.gargoylesoftware.htmlunit.html.HtmlScript
> > > > > isExecutionNeeded
> > > > > > WARNUNG: Script is not JavaScript (type: text/vbscript,
> language:
> > > > > vbscript). Skipping execution.
> > > > >
> > > > > this may be the root of the problem. If some functions are defined
> in
> > > > > vbscript, then HtmlUnit won't be able to find them later.
> > > > > A solution would be to simulate Firefox rather than IE.
> > > > >
> > > > > > - When I enable setThrowExceptionOnScriptError() I just get the
> > > first
> > > > > exception and then the program ends. But since the second
> exception
> > is
> > > > the
> > > > > same (when clicking on OK),
> > > > >  > I think this is not important as well.
> > > > > >
> > > > > > I'm totally stuck.
> > > > >
> > > > > :-(
> > > > > if you want more help than the one I can provide here, I provide
> > > > > professional support too.
> > > > >
> > > > > Cheers,
> > > > > Marc.
> > > > > --
> > > > > HtmlUnit support & consulting from the source
> > > > > Blog: http://mguillem.wordpress.com
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > > Start uncovering the many advantages of virtual appliances
> > > > > and start using them to simplify application deployment and
> > > > > accelerate your shift to cloud computing.
> > > > > http://p.sf.net/sfu/novell-sfdev2dev
> > > > > _______________________________________________
> > > > > Htmlunit-user mailing list
> > > > > [hidden email]
> > > > > https://lists.sourceforge.net/lists/listinfo/htmlunit-user
> > > >
> > > >
> > > > --
> > > > Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
> > > > Jetzt De-Mail-Adresse reservieren:
> http://portal.gmx.net/de/go/demail
> > > >
> > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > Start uncovering the many advantages of virtual appliances
> > > > and start using them to simplify application deployment and
> > > > accelerate your shift to cloud computing.
> > > > http://p.sf.net/sfu/novell-sfdev2dev
> > > > _______________________________________________
> > > > Htmlunit-user mailing list
> > > > [hidden email]
> > > > https://lists.sourceforge.net/lists/listinfo/htmlunit-user
> > > >
> >
> > --
> > GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99
> Euro/mtl.!*
> > http://portal.gmx.net/de/go/dsl
> >
> >
> >
> ------------------------------------------------------------------------------
> > Start uncovering the many advantages of virtual appliances
> > and start using them to simplify application deployment and
> > accelerate your shift to cloud computing.
> > http://p.sf.net/sfu/novell-sfdev2dev
> > _______________________________________________
> > Htmlunit-user mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/htmlunit-user
> >

--
GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 Euro/mtl.!*
http://portal.gmx.net/de/go/dsl

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

agent0056
  Hi,

it's me again with a little time.
I got everything to work with Watij. But the download (of the PDF file
at the end) lets pop up some windows which is a bit annoying.
Is is somehow possible to extract a session cookie from the running IE
instance of Watij and import it to HtmlUnit? So I could try to download
the file via HtmlUnit which works much smoother.
Thanks in advance.

Best Regards,

Tobias


Am 21.09.2010 08:14, schrieb Tobias Groch:

> Hi again,
>
> I tried the WebDriver, but it isn't working as well as HtmlUnit. First of all, it closes all other, manually opened, IE windows at start which is a no-go for me. Handling Check-&  Selectboxes is hard (or I am doing it wrong). I know it's an alpha and it's a great project, but it won't help me a lot.
> So I am stuck again.
>
> I will hopefully have contact to the web site author soon to get the JS problem with HtmlUnit working.
>
> Regards,
>
> Tobias
>
>
> -------- Original-Nachricht --------
>> Datum: Mon, 20 Sep 2010 00:14:35 -0700
>> Von: Justin Cummins<[hidden email]>
>> An: [hidden email]
>> Betreff: Re: [Htmlunit-user] Problem executing JS
>> Hi Tobias,
>>
>> I'm not a webDriver pro, but the safest way would be to write it again
>> yes,
>> although I don't think the API will be trouble for you. You might be able
>> to
>> transfer the session depending on how the webserver/site authenticate you.
>> If all that's needed is a session cookie, you can extract it from HtmlUnit
>> and insert it into your webDriver request. Again, though, I'd bet writing
>> the webDriver login code would be faster.
>>
>> ~Justin
>>
>> On Sun, Sep 19, 2010 at 10:48 PM, Tobias Groch<[hidden email]>  wrote:
>>
>>> Hi Justin,
>>>
>>> thanks for the information.
>>> Well, I am not just downloading files. I "configure" them beforehand and
>>> this needs to execute JS. But it seems that InternetExplorerWebDriver is
>> the
>>> thing I really need for that, although everything should work in
>> HtmlUnit
>>> theoretically.
>>> I'll give the WebDriver a try on that specific page. But there's one
>>> question now.
>>>
>>> How will I be able to "transfer" my browser session from HtmlUnit (I am
>>> logged in from the first page on) to InternetExplorerWebDriver? Please
>> don't
>>> say I have to code from scratch...
>>>
>>> Thank you very much.
>>>
>>> Best regards
>>>
>>> Tobias
>>>
>>>
>>> -------- Original-Nachricht --------
>>>> Datum: Sat, 18 Sep 2010 09:08:33 -0700
>>>> Von: Justin Cummins<[hidden email]>
>>>> An: [hidden email]
>>>> Betreff: Re: [Htmlunit-user] Problem executing JS
>>>> On Fri, Sep 17, 2010 at 4:14 AM, Tobias Groch<[hidden email]>
>> wrote:
>>>>> - I just changed a little code for using FF3.6, but FF can't execute
>>>> this
>>>>> vbscript neither. But I think it's not important since there only
>> seems
>>>> to
>>>>> be VB on the login page, that does not matter later on. I used IE
>> from
>>>> the
>>>>> beginning on since the site owner officially supports IE up to v7
>> and
>>> no
>>>>> other browses. Furthermore there seem to be other problems after
>>>> switching
>>>>> to FF. Do your FF and IE implementations use different JS engines?
>>>>>
>>>> Wow, I know it's not your site, but I cringe to think its "optimized
>> for
>>>> IE". :) No, all BrowserVersions use Rhino as the JS engine, but the
>> data
>>>> fed
>>>> to Rhino may be different.
>>>>
>>>>
>>>>> - Just discovered another warning I missed last time. It comes up
>> when
>>> I
>>>>> load the "faulty" page (just before the exception about the missing
>>>>> function).
>>>>> com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
>>>>> WARNUNG: Obsolete content type encountered: 'text/javascript'.
>>>>>
>>>> You can ignore this. "text/javascript" was officially deprecated,
>> however
>>>> its the only reliable type to use. "application/javascript" doesn't
>> work
>>>> everywhere.
>>>>
>>>>
>>>>> I'm just a student trying to get a project to work by "misusing"
>>>> HtmlUnit
>>>>> as a browser in background to download some files (whick works very
>>>> well,
>>>>> except the JS functions don't), since I don't see any other options
>> for
>>>> this
>>>>> task and HtmlUnit seems to be really great. So I don't know how your
>>>>> professional support works, but I for myself can't put money in this
>>>> project
>>>>> although I really, really appreciate your help.
>>>>>
>>>> There are some sites that don't work under HtmlUnit. If all you're
>> really
>>>> doing is downloading content take a look at WebDriver. You can use the
>>>> HtmlUnit driver most of the time but swap in any other browser for
>> sites
>>>> you
>>>> have problems with.
>>>>
>>>> ~Justin
>>>>
>>>>
>>>>> -------- Original-Nachricht --------
>>>>>> Datum: Fri, 17 Sep 2010 08:51:55 +0200
>>>>>> Von: Marc Guillemot<[hidden email]>
>>>>>> An: [hidden email]
>>>>>> Betreff: Re: [Htmlunit-user] Problem executing JS
>>>>>> Hallo Tobias,
>>>>>>
>>>>>> ...
>>>>>>
>>>>>>> There are two exceptions: one when loading the page and one when
>>>>>> clicking th OK-button to proceed to the next page. Both exceptions
>>> are
>>>>> the same.
>>>>>>> So that means, that the onload event does not work. Other events
>>>> like
>>>>>> clicking on the OK-button don't work neither (anymore), so that
>> with
>>>>> enabled
>>>>>> JS I cannot finish my whole request (see second exception).
>>>>>>> Where do I have to look for the function
>>>> "serviceOrPretestCheckChange"?
>>>>>> It does not show up in the normal browser's web sources.
>>>>>>
>>>>>> probably in some js file?
>>>>>>
>>>>>>> The page is http://etis.warley.fordstar.com/csg/checksheet.do
>>>>>>> The script called in the web page head:
>>>>>>> <script type="text/javascript" src="/js/ajaxUtil.js"></script>
>>>>>>> is not under http://etis.warley.fordstar.com/csg/js/ajaxUtil.js
>>>>>>> but under http://etis.warley.fordstar.com/js/ajaxUtil.js.
>>>>>> if src="/js/ajaxUtil.js" then it means that the browser should get
>> it
>>>>>> from http://etis.warley.fordstar.com/js/ajaxUtil.js
>>>>>>
>>>>>>> Is that important? Since the script does not contain the
>> function
>>>>>> "serviceOrPretestCheckChange".
>>>>>>
>>>>>> no idea if this is important in this case but if HtmlUnit behaves
>>>>>> differently here than the simulated browser, then it may be the
>> cause
>>>> of
>>>>>> the problem.
>>>>>>
>>>>>>> Other things to mention:
>>>>>>> - I got some CSS errors, but I don't think that's important.
>>>>>> I agree. Most of the CSS errors are probably errors of the CSS
>>> parser.
>>>>>>> - A few pages before I get to the error, the following warning
>>>> appears
>>>>>> (but it's not from the page where I have problems with):
>>>>>>> 14.09.2010 10:36:17
>> com.gargoylesoftware.htmlunit.html.HtmlScript
>>>>>> isExecutionNeeded
>>>>>>> WARNUNG: Script is not JavaScript (type: text/vbscript,
>> language:
>>>>>> vbscript). Skipping execution.
>>>>>>
>>>>>> this may be the root of the problem. If some functions are defined
>> in
>>>>>> vbscript, then HtmlUnit won't be able to find them later.
>>>>>> A solution would be to simulate Firefox rather than IE.
>>>>>>
>>>>>>> - When I enable setThrowExceptionOnScriptError() I just get the
>>>> first
>>>>>> exception and then the program ends. But since the second
>> exception
>>> is
>>>>> the
>>>>>> same (when clicking on OK),
>>>>>>   >  I think this is not important as well.
>>>>>>> I'm totally stuck.
>>>>>> :-(
>>>>>> if you want more help than the one I can provide here, I provide
>>>>>> professional support too.
>>>>>>
>>>>>> Cheers,
>>>>>> Marc.
>>>>>> --
>>>>>> HtmlUnit support&  consulting from the source
>>>>>> Blog: http://mguillem.wordpress.com
>>>>>>
>>>>>>
>>>>>>
>> ------------------------------------------------------------------------------
>>>>>> Start uncovering the many advantages of virtual appliances
>>>>>> and start using them to simplify application deployment and
>>>>>> accelerate your shift to cloud computing.
>>>>>> http://p.sf.net/sfu/novell-sfdev2dev
>>>>>> _______________________________________________
>>>>>> Htmlunit-user mailing list
>>>>>> [hidden email]
>>>>>> https://lists.sourceforge.net/lists/listinfo/htmlunit-user
>>>>>
>>>>> --
>>>>> Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
>>>>> Jetzt De-Mail-Adresse reservieren:
>> http://portal.gmx.net/de/go/demail
>>>>>
>>>>>
>> ------------------------------------------------------------------------------
>>>>> Start uncovering the many advantages of virtual appliances
>>>>> and start using them to simplify application deployment and
>>>>> accelerate your shift to cloud computing.
>>>>> http://p.sf.net/sfu/novell-sfdev2dev
>>>>> _______________________________________________
>>>>> Htmlunit-user mailing list
>>>>> [hidden email]
>>>>> https://lists.sourceforge.net/lists/listinfo/htmlunit-user
>>>>>
>>> --
>>> GMX DSL SOMMER-SPECIAL: Surf&  Phone Flat 16.000 für nur 19,99
>> Euro/mtl.!*
>>> http://portal.gmx.net/de/go/dsl
>>>
>>>
>>>
>> ------------------------------------------------------------------------------
>>> Start uncovering the many advantages of virtual appliances
>>> and start using them to simplify application deployment and
>>> accelerate your shift to cloud computing.
>>> http://p.sf.net/sfu/novell-sfdev2dev
>>> _______________________________________________
>>> Htmlunit-user mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/htmlunit-user
>>>

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

Marc Guillemot
Hi Tobias,

you can configure cookies as you want with HtmlUnit. But can you extract
them easily with watij?

Cheers,
Marc.
--
HtmlUnit support & consulting from the source
Blog: http://mguillem.wordpress.com



On 10/17/2010 11:06 AM, Tobias G. wrote:

>    Hi,
>
> it's me again with a little time.
> I got everything to work with Watij. But the download (of the PDF file
> at the end) lets pop up some windows which is a bit annoying.
> Is is somehow possible to extract a session cookie from the running IE
> instance of Watij and import it to HtmlUnit? So I could try to download
> the file via HtmlUnit which works much smoother.
> Thanks in advance.
>
> Best Regards,
>
> Tobias

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

Zhang Yufeng
In reply to this post by Tobias G.-2
Re: Problem executing JS
 
2010-10-19

*******************************************
Yufeng Zhang
National Laboratory for Parallel and Distributed Processing
The National University of Defense Technology
ChangSha, China
*******************************************

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem executing JS

viovicentejerome@gmail.com
This post has NOT been accepted by the mailing list yet.
In reply to this post by Tobias G.-2
Hi I wonder this thread was already closed,
I'm newby or a beginner in htmlunit.
I faced the same error or problem and able to solved it.
The problem there is that you I need to fire the event which is in this chase was the "onchange",
so I fired the event ,

final HtmlSelect destination = form.getSelectByName("some_element_Id");
HtmlOption optionDestination = destination.getOptionByValue(destinationString);
destination.setSelectedAttribute(optionDestination, true);
destination.fireEvent(Event.TYPE_CHANGE);
destination.fireEvent("change");

but then again same error occurs.
I also foundout that I need to wait for the call
I used this code.
//try 20 times to wait .5 second each for filling the page.
for (int i = 0; i < 20; i++) {
     synchronized (currentPage) {
          currentPage.wait(500);  // currentPage is the htmlpage
     }
}

then it solved the error, of course as you can see I need to wait for about 10 seconds

Hope this may help others who will face the same error.