Jump to content
Sign in to follow this  
Laurynelis

(firefox - ff.au3) Alternative methods for data input?

Recommended Posts

Laurynelis

Hello everyone!

Started playing with ff.au3 today and got into some problem with field inputs.

I am using

_FFSetValue('0.010','amount-input--0','id')

and it is setting the field correctly, but the website (kraken, trading platform) refreshes every 10 sec or so (without reload, only ajax probably) and the fields are getting cleared. Note: values stay after refresh if I enter them manually.

 

Is there any other method with ff.au3 to set fields correctly? Or maybe I am doing something wrong with the current method?

Edited by Laurynelis

Share this post


Link to post
Share on other sites
Laurynelis

Any info helps, thank you!

Going to try and learn the xpath method tommorow.

 

Don't want to give up and use "MouseClick" + "Send" functions just yet :)

Edited by Laurynelis

Share this post


Link to post
Share on other sites
Laurynelis
19 hours ago, Danp2 said:

Definitely don't give up! I was just pointing out that sometimes you have to jump through some hoops to get the automation working on some sites. Here's an example --

 

Good progress! This one was exactly what i needed. Thank you very much.

Interestingly it does not work for sending '.' so i have to figure that out somehow.

What i currently have:

$sAmount = _FFObjGet("amount-input--0", "id")
_FFSendReact($sAmount, "0,01")
 
 Func _FFSendReact($sElement, $sValue = "")
    If StringLeft($sElement, 7) = "OBJECT|" Then $sElement = StringMid($sElement, 8)
    If StringLeft($sElement, 1) = "." Then $sElement = "window.content.document" & $sElement
    _FFCmd('FFau3.sendReact=function sendReact(a,b){try{var c=FFau3.WCD.createEvent("KeyboardEvent");for (var i = 0, len = b.length; i < len; i++) {c.initKeyEvent("keypress",true,true,null,false,false,false,false,b.charCodeAt(i),b.charCodeAt(i));a.dispatchEvent(c);};return 1}catch(e){return-1}return 0};')
    _FFCmd("FFau3.sendReact(" & $sElement & ",'" & $sValue & "');")
EndFunc

 

Edited by Laurynelis

Share this post


Link to post
Share on other sites
Laurynelis
3 minutes ago, Danp2 said:

Actually, the last revision does work with a period. Try it out and let me know if you encounter any issues.

3710182.jpg

Everything is perfecto now!

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×