Jump to content

Need help for _FFclick


Recommended Posts

I created auto log in script for my router, just want  to learn this FF.au3 but Its hard to analyze/understand some example like this:

#Include <FF.au3>

 _FFStart("http://ff-au3-example.thorsten-willert.de/")

If _FFIsConnected() Then

    _FFClick("img", "tag", 5) ; clicks on the 5th image

    Sleep(1000)

    $sObj = _FFXpath("//img[@alt='test_bild_3']","",9) ; get the image with the alt-text test_bild_3 ...
    _FFClick($sObj) ; ... and click on it

    Sleep(1000)
    _FFWindowClose()
Else
    MsgBox(0,"Error:", "Can't connect to FireFox!")
EndIf

got confused with ("img", "tag", 5) ("//img[@alt='test_bild_3']","",9) from where did he get this?

I want to click button on my router like network status tab, how do I click the correct tab?

the syntax for ffclick is like

#Include <FF.au3>
_FFClick($sElement[, $sMode = "elements"[, $iIndex = 0[, $bLoadWait = True]]])

but where should i get this elements???  how will i get the correct elements??? ive been browsing google this forums since yesterday still cant find the answer...

and some example are not available here http://english.documentation.ff-au3.thorsten-willert.de/ff_functions/_FFClick.php

Edit: maybe some good samaritans will help me... just maybe o:) o:) o:)

Edit: this is what I got from running the example script above:

_FFConnect: OS:    WIN_7 WIN32_NT 7600
_FFConnect: AutoIt:    3.3.12.0
_FFConnect: FF.au3:    0.6.0.1b-10
_FFConnect: IP:    127.0.0.1
_FFConnect: Port:    4242
__FFStartProcess ==> General Error: Error reading registry entry for FireFox.
HKEY_LOCAL_MACHINESOFTWAREMozillaMozilla Firefox*CurrentVersion*MainPathToExe
Error from RegRead: 1
_FFConnect: Delay:     2ms
_FFConnect: Socket:     476
_FFConnect: Browser:    Mozilla/5.0 (Windows NT 6.1; rv:30.0) Gecko/20100101 Firefox/30.0
__FFSendJavaScripts: Sending functions to FireFox .......... done
_FFLoadWait: . loaded in 16ms
[object XrayWrapper [object HTMLDocument]] - {location: {...}, searchEngineLogo: {...}, searchForm: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...}
__FFSend: try{FFau3 != null?1:0}catch(e){'_FFCmd_Err';};
__FFRecv: 1
__FFSend: try{FFau3.simulateEvent(FFau3.WCD.getElementsByTagName('img')[5],'MouseEvents','click');}catch(e){'_FFCmd_Err';};
__FFRecv: -3
_FFClick ==> No match: $sElement: FFau3.WCD.getElementsByTagName('img')[5]
__FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//img[@alt='test_bild_3']",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv:
__FFSend: try{FFau3.simulateEvent(FFau3.xpath,'MouseEvents','click');}catch(e){'_FFCmd_Err';};
__FFRecv: -3
_FFClick ==> No match: $sElement: FFau3.xpath
__FFSend: try{window.close();}catch(e){'_FFCmd_Err';};
__FFRecv:

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

You should use Firebug to help you determine the attributes of the element you are interested in clicking. Then you would pass these attributes to _FFClick.

The sample script works properly for me. There have been some corrections to the UDF posted in the main Examples section thread. I suggest that you apply those and then let us know if you are still having issues.

Link to comment
Share on other sites

You should use Firebug to help you determine the attributes of the element you are interested in clicking. Then you would pass these attributes to _FFClick.

The sample script works properly for me. There have been some corrections to the UDF posted in the main Examples section thread. I suggest that you apply those and then let us know if you are still having issues.

Thanks for this info its kinda  challenging ill get bk to you asap....

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

You should use Firebug to help you determine the attributes of the element you are interested in clicking. Then you would pass these attributes to _FFClick.

The sample script works properly for me. There have been some corrections to the UDF posted in the main Examples section thread. I suggest that you apply those and then let us know if you are still having issues.

 

Hi, please could you provide me the link for this "There have been some corrections to the UDF posted in the main Examples section thread.", cant find it...  i copy some example from google to use with firebug but cant find the right element. firebug is kinda hard to use, and its harder than i thought, this is the html i copy to practice firebug.

<html>
<body>

<h1>My 1st JavaScript</h1>

<p>Click Date to display current day, date, and time.</p>

<button type="button" onclick="myFunction()">Date</button>

<p id="demo"></p>

<script>
function myFunction() {
    document.getElementById("demo").innerHTML = Date();
}
</script>

</body>
</html>

im feeling hopeless, could you show me an example for ffclick using the html script above??? thanks in advance...

EDIT: I add some func in ff click example it works but its kinda confusing i cant find the element that is clicked

#Include <FF.au3>

 _FFStart("http://ff-au3-example.thorsten-willert.de/")

If _FFIsConnected() Then
    _FFOpenUrl("http://ff-au3-example.thorsten-willert.de/"); line added
    _FFClick("img", "tag", 5) ; clicks on the 5th image

    Sleep(1000)

    $sObj = _FFXpath("//img[@alt='test_bild_3']","",9) ; get the image with the alt-text test_bild_3 ...
    _FFClick($sObj) ; ... and click on it


Else
    MsgBox(0,"Error:", "Can't connect to FireFox!")
EndIf
Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

Hi, please could you provide me the link for this "There have been some corrections to the UDF posted in the main Examples section thread.", cant find it...  i copy some example from google to use with firebug but cant find the right element. firebug is kinda hard to use, and its harder than i thought, this is the html i copy to practice firebug.

 

is one example. Read down a few posts from there for another.

Firebug isn't that hard. There are probably lots of tutorials online. Find one and follow it to get the basics of how it works. FWIW, the images are located at the very bottom of the test page.

Link to comment
Share on other sites

hello there,  got confused with this one, I search for the image 1 and this is what I found in the example script above

<img width="200" height="128" onclick="alert(this.alt)" alt="test_bild_3" src="http://www.thorsten-willert.de/bilder/gr_orange.png"> ; this is the test bild 3, 5th image

<img width="200" height="64" onclick="alert(this.alt)" alt="test_bild_2" src="http://www.thorsten-willert.de/bilder/gr_orange.png">;test build 2, 4th img

<a href="http://english.documentation.ff-au3.thorsten-willert.de/"><img border="0" alt="gb" src="http://www.thorsten-willert.de/bilder/gb.png">&nbsp;Documentation</a>; this one is the 1st image,

 how did it become the 1st img?  how to know the exact no. of image?

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

F12 will bring up developer tools, and the "inspector" will tell you the same thing basically.

I'll show a different example:

#include <FF.au3>

ShellExecute('http://www.autoitscript.com/forum/')
WinWaitActive('Mozilla Firefox')      ;Firefox open
_FFLoadWait(0, False)                 ;Page loaded
_FFConnect ()                         ;Connect to firefox
_FFSetValue('YOURLOGIN', 'ips_username', 'name')      ;Username but with name element
;_FFSetValue('YOURLOGIN', 'login_guideHandle', 'id')  ;Username but with id element
_FFSetValue('PassXXX', 'ips_password', 'name')        ;Name element
;_FFSetValue('PassXXX', 'login_password', 'id')       ;Id element
_FFClick('ipsButton', 'class')                        ;Click button

post-68092-0-76142800-1405969491_thumb.p

Edited by careca
Spoiler

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.

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...