Jump to content
Sign in to follow this  
leegold

_FFLinksGetAll() from FF.au3 - Interesting Behavior Noted...

Recommended Posts

leegold

Hi,

Using FF.au3 and Autoit beta 3.3.13.12. I've noticed something, given the code:

#include <FF.au3>
#include <Array.au3>

$url1 = 'http://www.autoitscript.com/site/autoit/'
_FFStart($url1)

Sleep(3000)

$aLinks = _FFLinksGetAll()
_ArrayDisplay($aLinks) ; displays autoit site links

Sleep(3000)

$url1 = 'http://www.autoitscript.com/site/uncategorized/gimagex-v2-1-1-released/'
_FFOpenURL($url1)

Sleep(3000)

$aLinks = _FFLinksGetAll()
_ArrayDisplay($aLinks) ; displays gimagex site links as I assumed it would

and _ArrayDisplay shows the links for the current page in Firefox - different page then different links shown as I expected.

But if I use _FFLinkClick (instead of _FFOpenURL) to get to the different page the links shown by FFLinksGetAll and _ArrayDisplay are for the previous page in Firefox not the current page. Try:

#include <FF.au3>
#include <Array.au3>

$url1 = 'http://www.autoitscript.com/site/autoit/'
_FFStart($url1)
_FFLoadWait()
Sleep(10000)

$aLinks = _FFLinksGetAll()
_ArrayDisplay($aLinks) ; displays autoit site links, note Row 24 link for example

Sleep(3000)

_FFLinkClick("GImageX v2.1.1 Released", "text")

Sleep(3000)

$aLinks = _FFLinksGetAll()
_ArrayDisplay($aLinks) ; still displays same autoit site links

Why the difference? Shouldn't the links displayed reflect the current page in the browser no matter how you get there?

Thanks.

 

Share this post


Link to post
Share on other sites
leegold

Yes I put a copy of FF.au3 in the beta includes folder so it would work of course. Not sure what you're getting at... :)

If there's a source for the latest FF.au3 file and I could update then of course I'd try that before anything else.

Share this post


Link to post
Share on other sites
Danp2

Actually, it's recommended that you don't store UDFs in the includes subdirectory. See here for more info.

I was trying to duplicate your issue earlier and I couldn't even get the FF functions to work. Turns out that I had previously put an old copy of FF.au3 in the includes subdirectory, which is why I used >_< above. <g>

What version of FF.au3 are you running? How many links are being returned for each page?

Share this post


Link to post
Share on other sites
Gonnosuke

Please post the console output of your script after adding "_FFAu3Option("ComTrace", True)" so we can see what's happening during execution. It could be a _FFWindowSelect issue etc. The console output will provide the clues we need to solve the problem.

Edited by Gonnosuke

Share this post


Link to post
Share on other sites
leegold

I never got back on this - I am sorry. FF.au3 is a great tool and I can/did worked around it.

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  

  • Similar Content

    • MakzNovice
      By MakzNovice
      Hello Experts,
      I am working on modifying table data of a browser currently in IE (soon in FF)
      My sequence of operations:
      1. Activate Browser
      2. Get Browser table
      3. Modify data  in table
      4. Suppress any warning/error message from webpage
      5. Activate the Webpage again 
      6. Send {F11} key sequence twice to achieve some update without Updating form ( {F5})
       
      My problem is at Step 5, as it activates the wrong window ( last used application rather than my browser window)
      My code snippet for it as follows
      $bFoundWindow = False Local $aList = WinList("[REGEXPTITLE:(?i)(.*Internet Explorer.*)]") Local $hWND = 0 For $i = 1 To $aList[0][0] If False = $bFoundWindow And $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 1) Then WinActivate($aList[$i][1]) ; 1. Activate Browser window WinSetState ( $aList[$i][1], "", @SW_MAXIMIZE) $hWND = $aList[$i][1] $objEditIE = _IEAttach ($aList[$i][1], "hwnd") $oTitles = _IETagNameGetCollection($objEditIE, "TITLE") For $oTitle In $oTitles $sTitle = $oTitle.innerText If $sTitle = $searchString Then MsgBox(0,"APPLICATION Found", "Got Edit List Window", 1) $bFoundWindow = True ExitLoop EndIf Next EndIf Next If False = $bFoundWindow Then MsgBox(0,"Error","Please launch Edit window for updating values in Browser prior to script execution",10) Exit EndIf ; MY CODE HERE TO MODIFY TABLE ; 2. Get Browser table ; 3. Modify data  in table ; Check if message from webpage pop-up window exists if so click ok on it Local $nCounter = 0 Local $nMaxCounter = 5 while 1 If WinExists("Message from webpage","") Then ControlClick("Message from webpage","","Button1","primary",1) ;4. Suppress any warning/error message from webpage Else $nCounter = $nCounter + 1 Sleep(100) ;MsgBox(0,"Counter", $nCounter, 1) If $nCounter = $nMaxCounter Then ExitLoop EndIf WEnd ;5. Activate the Webpage again  WinActivate($hWND) ; have already tried WinActivate($aList[$i][1]) but no success ;6. Send {F11} key sequence twice to achieve some update without Updating form ( {F5}) Send("{F11}") WinActivate($hWND) ;WinActivate($aList[$i][1]) Sleep(100) Send("{F11}") Any support will be highly appreciated
    • MakzNovice
      By MakzNovice
      I am using FF.au3, Since its proprietary I can't share image or link for the data I am using.
      But here is my problem abstract code .
      ; Test if I get table contents correctly
      ;$sCurr= _FFXPath("/html/body/form[1]/div[2]/div[3]/div[2]/table[@id='bodyTable']/tbody/tr[3]/td[4]", "textContent")
      ;MsgBox(0, "Current Value ", $sCurr, 2) ; output " -254.4"
      $sObj = _FFXPath("/html/body/form[1]/div[2]/div[3]/div[2]/table[@id='bodyTable']/tbody/tr[3]/td[4]")
      MsgBox(0, "Object", $sObj, 2) ; output "OBJECT|FFau3.xpath"
      $sRet = _FFObj($sObj, "value", "-253.4")
      MsgBox(0, "Return Value", $sRet); output " -253.4"
      $s = _FFXPath("/html/body/form[1]/div[2]/div[3]/div[2]/table[@id='bodyTable']/tbody/tr[3]/td[4]", "textContent")
      MsgBox(0, "New Value", $s); output " -254.4"
      My expectation is that that last MsgBox shows new value that I had set that is "-253.4"
      I would highly appreciate any support on this
       
    • rte7
      By rte7
      Hello. We work with the BMC Remedy site to manage incidents and would like to automate the processes of clicking through this button code:
      <a href="javascript:" class="btn btn3d menu" style="top:21; left:184; width:21; height:21;"> <img class="btnimg" src="../../../../resources/images/mt_sprites.gif" alt="menu category issue" title=""> </a> I use firefox with mozrepl and autoit with include FF.au3
      I need your help
      I read the topic https://www.autoitscript.com/forum/topic/95595-ffau3-v0601b-10/ but I could not run the code from the listed commands
      ...
      It is necessary to press the button and from the list of the menu of cahorsations to select the item = "zone of trust abonent"
      Screen # 1 http://joxi.ru/52aJK7bh4a7ypA or below.
      1) Press button
      <a href="javascript:" class="btn btn3d menu" style="top:21; left:184; width:21; height:21;"> <img class="btnimg" src="../../../../resources/images/mt_sprites.gif" alt="menu category issue" title=""> </a>
      2) After pressing the button, I need to choose in this menu of 4 items to select an item called "zone of trust abonent", Screen # 2 - http://joxi.ru/p27gwQKHo71VQ2
      html code table items
      <table class="MenuTable" cellpadding="0" cellspacing="0" style="width: 179px;"> <tbody class="MenuTableBody"> <tr class="MenuTableRow"> <td class="MenuEntryName" nowrap="">zone of trust abonent</td> <td class="MenuEntryNoSub" arvalue="zone of trust abonent"></td> </tr> <tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">zone of trust operator</td> <td class="MenuEntryNoSub" arvalue="zone of trust operator"></td> </tr> <tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">zone of trust third operator</td> <td class="MenuEntryNoSub" arvalue="zone of trust third operator"></td></tr> <tr class="MenuTableRow"><td class="MenuEntryNameHover" nowrap="">No settings</td> <td class="MenuEntryNoSubHover" arvalue="No settings"></td> </tr> </tbody> </table>
       
       
      More in detail, I choose from the menu item "zone of trust abonent" Screen # 3 - http://joxi.ru/GrqVq4ZIQEPW4m

       
      3) The choice is made, Screen # 4 http://joxi.ru/v297w6aC3PovLr
      <textarea class="text sr " wrap="off" id="arid_WIN_0_1000002488" cols="20" maxlen="60" style="top:21; left:0; width:179; height:21;" armenu="CFG:PRC:CategoryHPD-Res-T1-Q" mstyle="2" arautoc="1" arautocmb="1" arautocak="0" arautoctt="400" rows="1"> </textarea>
       
      It's all. I would be very grateful to you =) !!!!!!!!!!
      Here are more detailed codes in the attachment. 
      button1.txt
      menu - table.txt
      all.txt
    • milos83
      By milos83
      How can I check if element is focused in Firefox using FF.au3 UDF?
      This is my try:
      I have prepared a function that checks if the object is focused:
       
      _FFCmd('FFau3.isfocused=function isfocused(a){try{return (a === document.activeElement)}catch(e){return}}') $oElm = _FFXPath("//*[@id='someId']") ConsoleWrite(_FFIsFocused($oElm)) Func _FFIsFocused($sElement = "") Local $isFoc = _FFCmd("FFau3.isfocused(" & $sElement & ")") Return $isFoc EndFunc ;==>_FFIsFocused Now, the javascript part is tested and it does return successfully.
      After a lot of try/fails I inserted an alert box in order to display the object being compared.
      Here is what I got
       
      The focused object is: [object XULElement]
      The object that I send for comparing is [object HTMLInputElement]
      Why is that?
       
       
    • Mbee
      By Mbee
      I'm trying to determine the latest/easiest/best way (as of May 2016) to control & interact with Firefox using Autoit.
      To the best I've been able to determine, there have been two different ways to do this. Once upon a time, there was something called "Mozilla ActiveX control", but given all the security warnings I receive whenever I try to download it (the original host site appears to be absent or invalid), I'd prefer to avoid it. The other approach is/was to use a UDF called "FF.au3" developed -- but apparently no longer supported for English speakers -- by Stilgar (old thread is here: https://www.autoitscript.com/forum/topic/95595-ffau3-v0601b-10/). The most recent thread I could find (in English) was started by Danp2 here: https://www.autoitscript.com/forum/topic/167661-ffau3-v0601b-15/
      Although it certainly seems like using the FF UDF is the most recent and possibly only still-valid approach, getting anything sufficiently useful done with it strikes me as rather difficult, in part because the English documentation is so incomplete as to be unhelpful (and apparently incorrect as well), but also because it appears that to accomplish what I need to do might well require intimate knowledge of Firefox internals or APIs (maybe XULs too).  For example, there are functions such as _FFCmd() that takes arbitrary/undocumented strings, and _FFGetValue() and_FFSetValue() with no English documentation at all (besides the minimal function descriptions in the FF.au3 file itself).
      So, my question is: What is the latest and/or easiest and/or best way of interacting with Firefox using Autoit?  And what else do I need to learn first in order to use it effectively (such as Firefox developer APIs, etc)?
      Thanks!
×