Jump to content

FF.au3 (V0.6.0.1b-10)


Stilgar
 Share

Recommended Posts

How do I fill in a text box on a web page?

Text box is: <input type="text" id="ctl00_ContentPlaceCenterContent_login2_username" name="ctl00$ContentPlaceCenterContent$login2$username

Alright, found it: _FFSetValue("Hello", "ctl00_ContentPlaceCenterContent_login2_username", "id").

Thanks.

Edited by RichardL
Link to comment
Share on other sites

  • 2 weeks later...
  • 5 weeks later...
  • 3 weeks later...

There are no combo boxes in HTML documents.

There are <SELECT> elements.

Interactive with _FFFormOptionselect()

i can't get it work.

I use

_FFFormOptionselect("pselector", "id", 5)

(i get the id by using 'web developer' firefox addon), but i get this:

__FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//form[1]//select[@id='pselector']//option[position()=6]",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue.selected=true;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: _FFXPath_Error: TypeError: FFau3.WCD.evaluate("//form[1]//select[@id='pselector']//option[position()=6]", FFau3.WCD, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue is null
_FFXPath ==> No match: singleNodeValue is null $sQuery: //form[1]//select[@id='pselector']//option[position()=6] - selected=true
Link to comment
Share on other sites

How can I search for variable strings (regex)?

...like in your example page, it can't find "\d+x200", which should match twice, on "64x200" and "128x200".

In a page I'm scripting, I need to know how many results were returned. There is no way to know ahead of time what this number will be, so I can't search for a literal string.

Link to comment
Share on other sites

Another question... I have tried to use _FFLinkClick, which works sometimes, but not always... looking in the console, sometimes the xpath returned contains garbage...

Good result:

__FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//a[contains(@id,'editank')]",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: http://pro.imdb.com/search/edit?query_id=2185100
__FFSend: try{FFau3.simulateEvent(FFau3.xpath,'MouseEvents','click');}catch(e){'_FFCmd_Err';};
__FFRecv: 1
_FFLoadWait: ................ loaded in 4311ms

Bad result:

__FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//a[contains(@id,'editank')]",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: http://pro.imdb.com/search/edit?query_id=2185100 — {dispatchEvent: function() {…}, hasAttribute: function() {…}, parentNode: {…}, getAttribute: function() {…}}
__FFSend: try{FFau3.simulateEvent(FFau3.xpath,'MouseEvents','click');}catch(e){'_FFCmd_Err';};
__FFRecv: 1
_FFLoadWait: . loaded in 16ms
Link to comment
Share on other sites

My script interacts with this website http://www.weather.com/activities/health/allergies/

My source

#include <FF.au3>

#Include <Array.au3>

Local $oZipCode

Local $oSubmit

Local $ZipCode = "xxxxx"

$url = "http://www.weather.com/activities/health/allergies/"

$oFF = _FFStart($url)

$aArray = _FFXPath("//input[@value='Enter US city or zip']","",9)

MsgBox(64,"", _FFObj("xpath.type") & @crlf & _FFObj("xpath.value"))

_FFObj("xpath", "value", $ZipCode)

sleep(2000)

$aArray = _FFXPath("//input","src",7)

_ArrayDisplay($aArray)

MsgBox(0,"", $aArray)

_FFClick("input", "tag", 22)

MsgBox(0,"", _FFReadText(24))

On the page that comes up when you enter your zip i use _FFReadText to get the text that has the pollen forecast for my zip code.

However the text that i need, and a lot of other text doesnt come up. It seems like the page is inside another page.

How can i access text that doesnt come up from _FFReadText

Link to comment
Share on other sites

I figured out the last problem i had by reading the html source and then parsing it. I couldnt find the stuff i was looking for with xpath either but reading the source i was able to find what i needed. i have a new problem now

;Local $oFF = _FFStart($url)

;Local $oFF = _FFStart($url, default, 1, true)

when i use the first command my script runs however when i use the second command my mouse freezes and my script does nothing, not to mention the page still comes up, its not hidden.

;Local $oFF = _FFStart($url, default, 1, false)

when i use that my script runs fine.

Link to comment
Share on other sites

how i can use _FFImageClick() ? it always report

_FFImageClick("WebObjects/BalanceDo-v3_005.woa/Contents/WebServerResources/continue.gif")

_FFImageClick ==> No match: $vSearch: WebObjects/BalanceDo-v3_005.woa/Contents/WebServerResources/continue.gif

Link to comment
Share on other sites

  • 4 weeks later...

Hy I'm trying to "automate" the ClipnGrabber site (http://clipnabber.com/)... it is a site that permites to download videos from megavideo, youtube and etc...

Using FF.udf I've insert the megavideo link in the URL field and submitted the problem happens when I've to press the FLV button... I suppose it is created dinamycally by javascript so it's not present in the page source... but using FireBug I see this section after that the FLV button appears:

<div id="mv_flv" style="display: inline;"><div id="downloadflv"><a id="a_mv_flv" href="http://www1065.megavideo.com/files/738bc7c3de3cf75478f103e6865d73f8/***************************** [clipnabber.com].flv"><img title="" src="images/downloadflv-med.png"></a></div></div>

I've tried all ID but no success!

I suppose the solution can be to select that strange "a id="a_mv_flv" but "a id" is not a valid tag, obviouly!

This is my script:

#Include <FF.au3>

_FFConnect();

If _FFIsConnected() Then
    _FFOpenURL("http://clipnabber.com/")

    $sInput = _FFObjGet("url", "name") ; returns a string - no object!
    _FFObj($sInput, "value", "http://www.megavideo.com/?*******")
    MsgBox(64, "Suche: ", _FFObj($sInput, "value"))

    _FFClick("nab", "id");
    
    Sleep(15000);
    
     _FFImageClick("images/downloadflv-med.png", "src");
    
    _FFDisConnect();
EndIf

Thanks for your help!

Edited by fanoI
Link to comment
Share on other sites

  • 1 month later...

Am I missing something... I used to use FF.au3 no problems, I went to update a script and now I can not compile

D:\Program Files\AutoIt3\Include\FF.au3(4191,15) : WARNING: $RetVal: possibly used before declaration.
            If $RetVal >
            ~~~~~~~~~~~^
D:\Program Files\AutoIt3\Include\FF.au3(4193,13) : ERROR: 'Return' not allowed from global scope.
                Return 1
                ~~~~~~~~^
D:\Program Files\AutoIt3\Include\FF.au3(4195,34) : WARNING: $sFuncName: possibly used before declaration.
                SetError(__FFError($sFuncName,
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\Program Files\AutoIt3\Include\FF.au3(4195,87) : WARNING: $sLabel: possibly used before declaration.
                SetError(__FFError($sFuncName, $_FF_ERROR_InvalidExpression, "$sLabel: " & $sLabel)
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\Program Files\AutoIt3\Include\FF.au3(4196,13) : ERROR: 'Return' not allowed from global scope.
                Return 0
                ~~~~~~~~^
D:\Program Files\AutoIt3\Include\FF.au3(4199,13) : ERROR: 'Return' not allowed from global scope.
                Return 0
                ~~~~~~~~^
D:\Program Files\AutoIt3\Include\FF.au3(4201,3) : ERROR: syntax error
        Case
        ^
D:\Program Files\AutoIt3\Include\FF.au3(4191,15) : ERROR: $RetVal: undeclared global variable.
            If $RetVal >
            ~~~~~~~~~~~^
T:\Scripts\Ticket\Ticketer_0.0.7.4.au3 - 5 error(s), 3 warning(s)

All Errors are in FF.au3 Any suggestions?

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

I've got two test scripts which both do the same thing, just open a URL in a loop. I'm using ff.au3 _FFStart command and specifying a unique profile name and -no -remote flag.

Which ever script I start first works fine. The second script opens a FF window and MsgBoxes but then does nothing else.

Any pointers are greatly appreciated.

thanks,

mike

#include <FF.au3>

_FFStart("about:blank","Profile1", 9) 
;_FFStart("about:blank","Profile2", 9)  ####THE ONLY DIFFERENCE BETWEEN SCRIPTS IS WHICH PROFILE

MsgBox(0,"",$_FF_GLOBAL_SOCKET )

If _FFIsConnected() Then

    $num_loops = 0 
    Do

        _FFOpenURL("www.google.com", True)

        Sleep(2000)
        _FFTabClose("all", "keyword")
        ;$num_loops = $num_loops + 1

    Until $num_loops = 5

_FFQuit()

EndIf

plz help me

Link to comment
Share on other sites

  • 3 weeks later...

Hi. I have a huge problem. My code works fine until it loops 6 times. Everytime at 6 loop i had an error:

__FFWaitForRepl ==> Timeout: 10010ms > 10000ms $iTimeOut

It don't connect again on window it work before, but if I change window to new one, and wait for a while, it connect to this new opened window (but it's useless). Have any one any ideas? I used to try on different version of FF(3, 4, 5 and mozrepl for that) There is whole loop:

While 1
  $strona_gracza=0
  If _FFConnect(Default, 4243) Then
If $link_num=1 Then
  $sciezka="/html/body/form/div[3]/div/div[3]/div[2]/div/div[2]/div[5]/div/div/span[2]/h3/a"
  $link=_FFXPath($sciezka)
Else
  $sciezka="/html/body/form/div[3]/div/div[3]/div[2]/div/div[2]/div[5]/div["&$link_num&"]/div/span[2]/h3/a"
  $link=_FFXPath($sciezka)
EndIf
$klik=_FFClick($link)
_FFLoadWait()
If $klik=0 Then
  MsgBox(0, "", "Error ide do drugiej strony")
  $strona=$strona+1
  _FFLinkClick("ctl00_ctl00_CPContent_CPMain_ucPager_repPages_ctl01_p"&$strona)
  _FFLoadWait()
  ContinueLoop
EndIf
$strona_gracza=1
  $a=$kogo&':</td><td><imgsrc="/App_Themes/Standard/progressBar/p3.png"alt="'
  $b='/20"title'
  $html=_FFReadHTML()
  $czysty=StringStripWS($html, 8)
  ;FileWrite("C:/html.txt", $html)
  $tekst = _StringBetween($czysty,$a,$b)
  If Not @error Then
  If Number($tekst[0])>$skill Then
   $html=_FFReadHTML()
    $a='BrowseIds=">'
    $b='</a>'
    $tekst=_StringBetween($html, $a, $b)
    $pilkarz=$tekst[0]
    $a='PlayerID='
    $b='&amp;BrowseIds='
    $tekst=_StringBetween($html, $a, $b)
    $id=$tekst[0]
    $a='Najwy|szaoferta:'
    $b='zBzBo|ona'
    $czysty=StringStripWS($html, 8)
    $tekst=_StringBetween($czysty, $a, $b)
    If $tekst=0 Then
     $a='wywoBawcza: '
     $b=' zB</p>'
     $czysty=StringStripWS($html, 8)
     $tekst=_StringBetween($czysty, $a, $b)
    EndIf
    $tekst_po=StringReplace($tekst[0], " ", " ")
    FileWriteLine("C:/zawodnicy.txt", $pilkarz&" "&$id&" "&$tekst_po)
  EndIf
EndIf
If $strona_gracza=1 Then
  $link_num=$link_num+1
   _FFAction("back")
   _FFLoadWait()
EndIf
EndIf
WEnd
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...