Problem to click a link with javascript action in href attribute

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

Problem to click a link with javascript action in href attribute

Guillaume Lepinay
Hello every body,

I have a link like this : 

<a tabindex="2" href="javascript:raf()">
&nbsp;&nbsp;0&nbsp;&nbsp;
</a>

I can find it with HtmlUnit and I use the click() method to execute the javascript (method raf() in this example).
But nothing happens.

The script doesn't run any ajax request. It only changes the value of another field.
But after clicking, when I get the value of the input that should have changed, it is still the same.

Is there something special to click this kind of link ?

Thank you for your help.

i'm using HtmlUnit 2.23. With the 2.27 and 2.28 SNAPSHOT I get an error due to illegal character inside the javascript pages.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem to click a link with javascript action in href attribute

RuralHunter
Hi Guillaume,

You'd better wait for some time after the click by WebClient.waitXXXXXX, especially for those scripts with ajax calls.

在 2017/6/26 16:59, Guillaume Lepinay 写道:
Hello every body,

I have a link like this : 

<a tabindex="2" href=<a class="moz-txt-link-rfc2396E" href="javascript:raf()">"javascript:raf()">
&nbsp;&nbsp;0&nbsp;&nbsp;
</a>

I can find it with HtmlUnit and I use the click() method to execute the javascript (method raf() in this example).
But nothing happens.

The script doesn't run any ajax request. It only changes the value of another field.
But after clicking, when I get the value of the input that should have changed, it is still the same.

Is there something special to click this kind of link ?

Thank you for your help.

i'm using HtmlUnit 2.23. With the 2.27 and 2.28 SNAPSHOT I get an error due to illegal character inside the javascript pages.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem to click a link with javascript action in href attribute

Guillaume Lepinay
Hello,

I also tried this :

HtmlAnchor link = mapDigits.get(chiffre);
link.click();
webClient.waitForBackgroundJavaScript(2000);
webClient.waitForBackgroundJavaScriptStartingBefore(2000);

but still the same problem.

Note that there is NO ajax call in the script. It does just change the value of 2 hidden field of a form.
But after the call, even after waiting, the value has not been changed.

Le lun. 26 juin 2017 à 11:16, Rural Hunter <[hidden email]> a écrit :
Hi Guillaume,

You'd better wait for some time after the click by WebClient.waitXXXXXX, especially for those scripts with ajax calls.


在 2017/6/26 16:59, Guillaume Lepinay 写道:
Hello every body,

I have a link like this : 

<a tabindex="2" href="javascript:raf()">
&nbsp;&nbsp;0&nbsp;&nbsp;
</a>

I can find it with HtmlUnit and I use the click() method to execute the javascript (method raf() in this example).
But nothing happens.

The script doesn't run any ajax request. It only changes the value of another field.
But after clicking, when I get the value of the input that should have changed, it is still the same.

Is there something special to click this kind of link ?

Thank you for your help.

i'm using HtmlUnit 2.23. With the 2.27 and 2.28 SNAPSHOT I get an error due to illegal character inside the javascript pages.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
--
Cordialement,
Guillaume Lepinay
09 52 95 97 99

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem to click a link with javascript action in href attribute

Guillaume Lepinay
Hello, with the example no more idea ?
If you need more information feel free to ask me :)

Le lun. 26 juin 2017 à 12:11, Guillaume Lepinay <[hidden email]> a écrit :
Hello,

I also tried this :

HtmlAnchor link = mapDigits.get(chiffre);
link.click();
webClient.waitForBackgroundJavaScript(2000);
webClient.waitForBackgroundJavaScriptStartingBefore(2000);

but still the same problem.

Note that there is NO ajax call in the script. It does just change the value of 2 hidden field of a form.
But after the call, even after waiting, the value has not been changed.

Le lun. 26 juin 2017 à 11:16, Rural Hunter <[hidden email]> a écrit :
Hi Guillaume,

You'd better wait for some time after the click by WebClient.waitXXXXXX, especially for those scripts with ajax calls.


在 2017/6/26 16:59, Guillaume Lepinay 写道:
Hello every body,

I have a link like this : 

<a tabindex="2" href="javascript:raf()">
&nbsp;&nbsp;0&nbsp;&nbsp;
</a>

I can find it with HtmlUnit and I use the click() method to execute the javascript (method raf() in this example).
But nothing happens.

The script doesn't run any ajax request. It only changes the value of another field.
But after clicking, when I get the value of the input that should have changed, it is still the same.

Is there something special to click this kind of link ?

Thank you for your help.

i'm using HtmlUnit 2.23. With the 2.27 and 2.28 SNAPSHOT I get an error due to illegal character inside the javascript pages.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
--
Cordialement,
Guillaume Lepinay
<a href="tel:09%2052%2095%2097%2099" value="+33952959799" target="_blank">09 52 95 97 99
--
Cordialement,
Guillaume Lepinay
09 52 95 97 99

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem to click a link with javascript action in href attribute

Ronald Brill
>> i'm using HtmlUnit 2.23. With the 2.27 and 2.28 SNAPSHOT I get an error
>> due to illegal character inside the javascript pages.

Have you tried it with the latest team city build? The illegal char should be fixed.



On Tue, 27 Jun 2017 20:15:11 +0000 Guillaume Lepinay wrote:

>
>Hello, with the example no more idea ?
>If you need more information feel free to ask me :)
>
>Le lun. 26 juin 2017 ? 12:11, Guillaume Lepinay <[hidden email]> a écrit :
>
>> Hello,
>>
>> I also tried this :
>>
>> HtmlAnchor link = mapDigits.get(chiffre);
>> link.click();
>> webClient.waitForBackgroundJavaScript(2000);
>> webClient.waitForBackgroundJavaScriptStartingBefore(2000);
>>
>> but still the same problem.
>>
>> Note that there is NO ajax call in the script. It does just change the
>> value of 2 hidden field of a form.
>> But after the call, even after waiting, the value has not been changed.
>>
>> Le lun. 26 juin 2017 ? 11:16, Rural Hunter <[hidden email]> a
>> écrit :
>>
>>> Hi Guillaume,
>>>
>>> You'd better wait for some time after the click by WebClient.waitXXXXXX,
>>> especially for those scripts with ajax calls.
>>>
>>>
>>> ? 2017/6/26 16:59, Guillaume Lepinay ??:
>>>
>>> Hello every body,
>>>
>>> I have a link like this :
>>>
>>> *<a tabindex="2" href="javascript:raf()">*
>>> *&nbsp;&nbsp;0&nbsp;&nbsp;*
>>> *</a>*
>>>
>>> I can find it with HtmlUnit and I use the click() method to execute the
>>> javascript (method raf() in this example).
>>> But nothing happens.
>>>
>>> The script doesn't run any ajax request. It only changes the value of
>>> another field.
>>> But after clicking, when I get the value of the input that should have
>>> changed, it is still the same.
>>>
>>> Is there something special to click this kind of link ?
>>>
>>> Thank you for your help.
>>>
>>> i'm using HtmlUnit 2.23. With the 2.27 and 2.28 SNAPSHOT I get an error
>>> due to illegal character inside the javascript pages.
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>
>>>
>>>
>>> _______________________________________________
>>> Htmlunit-user mailing [hidden email]://lists.sourceforge.net/lists/listinfo/htmlunit-user
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Htmlunit-user mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/htmlunit-user
>>>
>> --
>> Cordialement,
>> Guillaume Lepinay
>> www.clangen.com
>> 09 52 95 97 99
>>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user