Jump to content

FF3 and XPath return data only from first web-page


Recommended Posts

Hello,

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

Richard.

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)


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

            beep(600, 20) ;
        Next
    Next

    beep(300,20) ; so I can change page manually
    Sleep(5000)  ; wait while I change pages
Next
Link to comment
Share on other sites

  • 4 weeks later...

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?

Richard.

Func Do_OK($sLbl)
    Local $elem, $posarr[6], $x1, $y1
    ConsoleWrite(StringFormat("Do_OK_1 %s\n", $sLbl))
    Beep(400, 30)
    Sleep(100)
    _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)
    Sleep(500)
    MouseClick("Primary", $x1, $y1)
    Sleep(100)
    _FFLoadWait()
    _FFAu3Option("ComTrace", False)
    Sleep(200)
    ConsoleWrite(StringFormat("Do_OK_2 %s\n\n", $sLbl))
EndFunc
 
 
Do_OK("D")
Link to comment
Share on other sites

  • 1 year later...

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