Jump to content
Sign in to follow this  

FF3 and XPath return data only from first web-page

Recommended Posts


I'm using FF.au3 to read data from a sequence of web-pages. Each one same format. The code works and reads the correct data from any one page. Problem is, when I change page and repeat, it returns exactly the same values again. I can see the new page on screen, I can hear the beep for each read, so where is it getting the same data from? Does FF.au3 or MozRepl have an internal data store for XPath that I need to clear when I change page?

(Data is from finance site, so please excuse me omitting names and full code.)


For $iWP = 1 to 3                   ; Web Pages
    For $iItmIx = 1 to 5            ; Items
        For $iColIx = 2 to 2; 1 to 5    ; Columns

            $sXP = "/html/body/table/tbody/tr[2]/td/table/tbody/tr/td[2]/table[3]"
            $sXP &= "/tbody/tr[3]/td/table/tbody/tr[3]"
            $sXp &= StringFormat("/td/table/tbody/tr[%d]/td[%d]",$iItmIx, $iColIx)

            $sTmp = _FFObj("xpath.textContent")
            ConsoleWrite(StringFormat("CT C %s\n", $sTmp))

            beep(600, 20) ;

    beep(300,20) ; so I can change page manually
    Sleep(5000)  ; wait while I change pages

Share this post

Link to post
Share on other sites

Well, I've successfully gone around the problem. The code that reads each page is in a separate .exe. One program switches through the web-pages and ShellExecutes the .exe for each one.

Share this post

Link to post
Share on other sites

Now I've found another similar problem. Logging in to a site has an 'ok' button on each of 3 pages. The HTML for the 3 buttons is the same. This code works on the first 2 but fails on the 3rd. If I run it from a separate task it succeeds.

Does anyone know how to work on this problem? Is the problem in my code? FF.Au3? Mozrepl? Can I avoid the problem?


Func Do_OK($sLbl)
    Local $elem, $posarr[6], $x1, $y1
    ConsoleWrite(StringFormat("Do_OK_1 %s\n", $sLbl))
    Beep(400, 30)
    _FFAu3Option("ComTrace", True)
    $elem   = StringFormat("window.content.wrappedJSObject.top.document.getElementsByName('ok')[0]")
    $posarr = _FFGetPosition($elem)
    AutoItSetOption("MouseCoordMode", 2)
    $x1 = $posarr[0] + $posarr[2] + 40
    $y1 = $posarr[1] + $posarr[3] + 10
    MouseMove($x1, $y1, 1)
    MouseClick("Primary", $x1, $y1)
    _FFAu3Option("ComTrace", False)
    ConsoleWrite(StringFormat("Do_OK_2 %s\n\n", $sLbl))

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...