Jump to content
sonic208

firefox au3 doesnt work for clicking on a button

Recommended Posts

sonic208

excuse me what do you mean by calling _FFXPath? so do i first have to open a new variable and declare it with _FFXPath( Path) and then use it in FFCmd after FFau3. as xpath? i did this now :

$path = _FFXPath(".//*[@id='checkboxDisable']/li[1]/label")
    $card = _FFCmd("FFau3.$path.innerHTML")
    MsgBox(0,"",$card)

the msg box says now : FFCmd_Err

Share this post


Link to post
Share on other sites
Danp2

After successfully calling _FFXpath, you should be able to access the element and it's attributes like this:

FFXPath(".//*[@id='checkboxDisable']/li[1]/label")
$card = _FFCmd("FFau3.xpath.innerHTML")
MsgBox(0,"",$card)

Basically, FFau3.xpath hold a reference to the last item found with _FFXPath.

  • Like 1

Share this post


Link to post
Share on other sites
sonic208

oommg it worked,,, danp2 thank you so much !!!! innerhtml worked, textcontent not. man,,, i didnt believe that i could ever figure out all these things.. the german forum members couldnt help me.. this showed me again to never give up and believe in the good in human..
have a good night dnp2 and the other guy with the baby profile pic

Share this post


Link to post
Share on other sites
careca
14 hours ago, sonic208 said:

sry i still didnt find the edit button to edit a post ?

Not really a button, it's just "Edit" in hyperlink colors, here it's in blue, and right to the "quote", only exists in your posts obviously, and with the user logged on.

 

PS: It's not just any baby, its Stewie! ;)

Edited by careca
  • Like 2

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
sonic208

i got another problem now... it doesnt has to do now anything with this problem. its about the _ffsetvalue function, it perfectly works for me with all other textfields, but not with the ones of the other formular. its for typing in the adress data on amazon , but at this point _ffsetvalue seems not to be working ? and im not finding any other function for that . i post the html codes of the textfields that work totally fine and then of the fields that dont get filled with the information

 

<input id="addCreditCardNumber" name="addCreditCardNumber" size="25" autocomplete="off" type="text"/>

when i do it here it works totally fine

<input id="enterAddressFullName" class="enterAddressFormField enterAddressFieldICAMLong" name="enterAddressFullName" size="50" maxlength="50" type="text"/>

i tried it then with xpath and with ffclick, just to see if the textfield gets clicked and that doesnt work too

_FFOpenUrl("https://www.amazon.de/gp/css/account/cards/view.html/ref=add_pay_meth?ie=UTF8&viewID=addCard") ; Kontoinformationen hinzufügen
_FFClick(_FFXPath(".//*[@id='paymentMethodCARD']"))
_FFSetValue("M0","creditCardIssuer","id")
_FFSetValue("554641160082581","addCreditCardNumber","id")
_FFSetValue("2018","newCreditCardYear","id") 
_FFSetValue($name,"card-name","id") ; so these 4 fields work totally fine, they seem to be in another form
$path = _FFXPath(".//*[@id='enterAddressFullName']")
_FFSetValue($adresse,$path)
_FFClick($path)
_FFSetValue($stadt,"enterAddressCity","id")
_FFSetValue($plz,"enterAddressPostalCode","id")
_FFSetValue("07642888483","enterAddressPhoneNumber","id")

where could the problem be ? i also tried it with the class and name parameter..

Edited by sonic208

Share this post


Link to post
Share on other sites
careca

I really think you should create a new topic, since it's not the same issue, but anyway..

I can't get to that page to see the page source, but i assume you done it right.

Sometimes stuff inside iframes are more tricky, if i remember right, you have to enter the iframe first.

Is that field inside any iframe? Danp2 where are you? ;)

  • Like 1

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
sonic208

hmm it should be the same as the amazon page of uk .. its the page where you add a new credit card. the creditcard fields with the card number and the name work properly. the next fields are for the name, adress , postal code etc.

@danp2 ofc not :D:D

Share this post


Link to post
Share on other sites
sonic208
12 hours ago, Danp2 said:

Only issue I can see is that you are setting these fields to blank (none of the variable values have been set).

no thats not the point i declared the variables on the beggining of the script

i anyway tried to replace the variables with strings that doesnt work too.. so there must be a problem in the form right ? as it seems even with xpath the field cant be found.. because as i already said the _ffclick doesnt work so its not the problem of _ffsetvalue ..

#include<FF.au3>
#include <File.au3>

accerstellen()

Func accerstellen()

HotkeySet("+!e","ende")
$vornamefile = FileOpen("vorname.txt")
$zufallvorname= Random(1,55,1)
$nachname= "Berg"
$vorname = FileReadLine( $vornamefile,$zufallvorname)
$emailnummer = 4
$logfile =  FileOpen("log.txt",1)
$adresse= "lehenhof 10"
$stadt="michaelsberg"
$plz="79343"


$name = $vorname & " " & $nachname
_FFStart("https://www.amazon.de/ap/register?_encoding=UTF8&openid.assoc_handle=deflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.de%2Fgp%2Fyourstore%2Fhome%3Fie%3DUTF8%26ref_%3Dnav_custrec_newcust", "default", 1, False)
If _FFIsConnected() Then

    _FFSetValue($name,"ap_customer_name","id")
    _FFSetValue("tests208","ap_password","id")
    _FFSetValue("tests208","ap_password_check","id")
    _FFSetValue("entonstests+test" & $emailnummer & "@gmail.com","ap_email","id")
    _FFClick("continue","id")

FileWrite("log.txt","entonstests+test" & $emailnummer & " wurde erfolgreich erstellt. " & @CRLF  )
_FFOpenUrl("https://www.amazon.de/gp/css/account/cards/view.html/ref=add_pay_meth?ie=UTF8&viewID=addCard") ; Kontoinformationen hinzufügen
_FFClick(_FFXPath(".//*[@id='paymentMethodCARD']"))
_FFSetValue("M0","creditCardIssuer","id")
_FFSetValue("554641160082581","addCreditCardNumber","id")
_FFSetValue("2018","newCreditCardYear","id")
_FFSetValue("abc","card-name","id")
$path = _FFXPath(".//*[@id='enterAddressFullName']")
_FFSetValue("abc",$path)
_FFClick($path)
_FFSetValue($stadt,"enterAddressCity","id")
_FFSetValue($plz,"enterAddressPostalCode","id")
_FFSetValue("07642888483","enterAddressPhoneNumber","id")

EndIf
EndFunc

i cant think of any problem in the script but i posted it in case im blind :D

Share this post


Link to post
Share on other sites
Danp2
_FFSetValue($stadt,"enterAddressCity","id")

I don't use _FFSetValue. This works for me --

UpdateWebForm('enterAddressCity', 'test value')

Func UpdateWebForm($cField, $cValue)
    _FFXPath("//form//input[@id='" & $cField & "']")
    _FFCmd("FFau3.xpath.value='" & $cValue & "'")
EndFunc

 

Share this post


Link to post
Share on other sites
sonic208

hey i tried this out too and it doesnt work.. it just leaves the textfields blank... could you please when you have time try out whether you can fill the fields somehow or whether my code works?  i created an account on the amazon.de page, autoitscripttest@gmail.com and the password is autoitscript. im very curious about the reason why its not working... can it somehow be that amazon uses 2 formulars ? step 1 is the creditcard information, all fields get set properly. then there it sais step 2 for the adress details , so perhaps there can be a problem and autoit / mozrepl cant take hold of the second formular ? thank you very much

Edited by sonic208

Share this post


Link to post
Share on other sites
sonic208

oh ok thats makes me happy and sad, happy because i know it can work and sad that im perhaps too dumb to implement that function ?

#include<FF.au3>
#include <File.au3>

accerstellen()
; wie machen wir das mit dem algorithmus am besten
Func accerstellen()

HotkeySet("+!e","ende")
$vornamefile = FileOpen("vorname.txt")
$zufallvorname= Random(1,55,1)
$nachname= "Berisha"
$vorname = FileReadLine( $vornamefile,$zufallvorname)
$emailnummer  =6
$logfile =  FileOpen("log.txt",1)
$adresse= "lehenhof 5"
$stadt="endingen"
$plz="79346"


$name = $vorname & " " & $nachname
_FFStart("https://www.amazon.de/ap/register?_encoding=UTF8&openid.assoc_handle=deflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.de%2Fgp%2Fyourstore%2Fhome%3Fie%3DUTF8%26ref_%3Dnav_custrec_newcust", "default", 1, False)
If _FFIsConnected() Then

    _FFSetValue($name,"ap_customer_name","id")
    _FFSetValue("rraki208","ap_password","id")
    _FFSetValue("rraki208","ap_password_check","id")
    _FFSetValue("entonaqua+test" & $emailnummer & "@gmail.com","ap_email","id")
    _FFClick("continue","id")

FileWrite("log.txt","entonaqua+test" & $emailnummer & " wurde erfolgreich erstellt. " & @CRLF  )
_FFOpenUrl("https://www.amazon.de/gp/css/account/cards/view.html/ref=add_pay_meth?ie=UTF8&viewID=addCard") ; Kontoinformationen hinzufügen
_FFClick(_FFXPath(".//*[@id='paymentMethodCARD']"))
_FFSetValue("M0","creditCardIssuer","id")
_FFSetValue("554641160082581","addCreditCardNumber","id")
_FFSetValue("2018","newCreditCardYear","id")
_FFSetValue("abc","card-name","id")
UpdateWebForm('enterAddressFullName', 'hallo')
UpdateWebForm('enterAddressCity', 'test value')


EndIf
EndFunc

Func UpdateWebForm($cField, $cValue)
    _FFXPath("//form//input[@id='" & $cField & "']")
    _FFCmd("FFau3.xpath.value='" & $cValue & "'")
EndFunc

Func ende()
    Exit
EndFunc

 

Share this post


Link to post
Share on other sites
Danp2

Taking a closer look at the site's coding, it appears to contain multiple forms with the same elements. Therefore, you will have to first identify the correct form and then access it's elements.

  • Like 1

Share this post


Link to post
Share on other sites
sonic208

hmm okay thank you very much. meanwhile i got another idea, first i add the adress on another page that works fine. then i click add payment method and that works also fine, this means the fields with cc-information get filled and sent, but then it sais wrong bank data ->  the creditcard-radiobutton gets clicked properly, so that the creditcard information appear and not the iban/bic etc. then the cc-information is filled and via normal FFClick it is sent and anyway it appears that the browser thinks i wanted to register an bankaccount( i hope my english is not so bad and you can understand the problem) How can this be ? the radiobutton obviously gets clicked so why does it understand it anyway as an bankaccount registration ?  this is so extremly strange.. i really cant understand this...

and with your idea i have a problem too, i mean how can i identify the form ? i scrolled through the html code to find the form and tried some id´s that seemed logically to me but i couldnt identify the form id  / name.. ( i only kind of understand the structure of html but im not capable of it ) ... i hope im not too annoying and you can help me somehow... thx..

Edited by sonic208

Share this post


Link to post
Share on other sites
Danp2

This appears to work when you encounter multiple elements with the same id --

Func UpdateWebForm($cField, $cValue, $iIndex = -1)
    $sXpath = "//input[@id='" & $cField & "']"

    If $iIndex = -1 Then
        _FFXPath($sXpath)

        If @error = $_FF_ERROR_Success Then
            _FFCmd("FFau3.xpath.value='" & $cValue & "'")
        EndIf
    Else
        $sCmd ="FFau3.obj=FFau3.xpath;FFau3.xpath=FFau3.WCD.evaluate(" & '"' & $sXpath & '"' & ",FFau3.obj.parentNode,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null)"

        _FFCmd($sCmd)
        _FFCmd("FFau3.xpath.snapshotItem(" & $iIndex & ").value='" & $cValue & "'")
    EndIf
EndFunc

To update the desired element, you would call it like so --

UpdateWebForm('enterAddressCity', 'test value', 2)

 

  • Like 1

Share this post


Link to post
Share on other sites
sonic208

sir, you're a genius. you should get an award, i swear
thank you so much, if your help and engagement werent  i wouldnt know what to do and give up... !!!!!!

 

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

×