Sign in to follow this  
Followers 0
Laurynelis

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

7 posts in this topic

#1 ·  Posted (edited)

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



#2 ·  Posted

You may want to review this thread for one technique --

However, it's likely that you will run into the same issue because the site is using events to detect user input.

1 person likes this

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

#4 ·  Posted

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 --

 

1 person likes this

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

#6 ·  Posted

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

1 person likes this

Share this post


Link to post
Share on other sites

#7 ·  Posted

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!

1 person likes this

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  
Followers 0