Jump to content
Sign in to follow this  
Bert

Automate firefox

Recommended Posts

@dmob:

If you only use the nsIDownloadManager-interface you don't have to open downloads-window.

The informations about a download, I've got from downloads-window, can you get via the activeDownloads (enumeration of active nsIDownloads) and getDownload-function, too.

@fspafford:

I see.

If you want you can try the new unofficial-version of the FF.au3:

http://thorsten-willert.de/Themen/AutoIt-FF.au3/Testversion/

In this version _FFClick is simpler to use e.g.

_FFClick($Socket, "IdOfElement", "id") or

_FFClick($Socket, "NameOfElement", "name", iIndexOfElement)

Share this post


Link to post
Share on other sites

@stilgar

Yes, yes YES! I got it working via the nsIDownloadManager-interface.

You've made me a very happy man! If you ever find yourself in South Africa I'll buy you a keg of beer!

Thank you so much for your help.

[EDIT]

My next milestone is to monitor uploads...

[/EDIT

Edited by dmob

Share this post


Link to post
Share on other sites

@trinitrotoluen:

- How can I remove Frame or Stop loading frame:

Do you wanna stop loading a single frame or the complete frameset? And what do you mean with removing a frame?

For EX : the page contains 2 frames : frame[0] and frame[1] and when I use _FFopenURL the page will load 2 frame together. I don't want to load the second frame (frame[1]), only want to load frame[0].

Sorry for my bad ENG !

Ps : How do you use telnet to cotrol Repl Stilgar ? I tried NetCat and Putty but both also have a problem to enter command. And how do I exit the script when I close Firefox manually.

Edited by trinitrotoluen

Share this post


Link to post
Share on other sites

@trinitrotoluen:

At first you must load the complete frameset and then you can do it this:

_FFOpenURL($Socket,_FFSetGet($Socket,".getElementsByName('NameOfTheFrame')[0].src"))

but this is little bit "slow" if you would do something other in script, too.

- or you can check if the firefox.exe process is running

Share this post


Link to post
Share on other sites

_FFStart ([$sURL = "about: blank" [, $sProfile = "default" [, $iMode = 1 [, $bHide = False [, $IP = "127.0.0.1" [, $iPort = 4242]]] ]]])

I want to hide the Firefox

How can i achieve it >

$Socket = _FFStart("http://sometest.com/","auto",1,false)
_FFLoadWait ($Socket)

I tried to put false there like

False,false,"false","False"

Not working

Why it is not hiding the window ?

Share this post


Link to post
Share on other sites

[EDIT]

I have a problem with the run() function. If I starting FF with a commandline parameter, all show_flags do not work ? :)

That's a new problem, but I don't know if it is a problem from the run() function or from FF.

Edited by Stilgar

Share this post


Link to post
Share on other sites

Im using the function _FFGetLinks(), but it seems not to be working

i first used FF_PAGE_ANALYSER which gave me about 50 links on the page.

How can i load a link i find (32 for example?) ? i thought this would do it:

$linksarray= _FFGetLinks($Socket2)

$Socket3= _FFOpenURL ($Socket2,$linksarray[32])

it doesnt work tho. I get an error that $linksarray[32] is not an array ?

thx for any help

Share this post


Link to post
Share on other sites

Do you see any error in the editor console?

Here's is a short example, that works:

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

$Socket = _FFConnect()
If $Socket > -1 Then
$linksarray = _FFGetLinks($Socket)
_ArrayDisplay($linksarray)
_FFOpenURL ($Socket,$linksarray[1])
EndIfoÝ÷ Ù»­ü¨»
.ÙhiÛazX§ÍöÊjwh¶¬¶ºÚ"µÍÚ[ÛYH Ñ]LÉÝÂÌÍÔÛØÚÙ]HÑÛÛXÝ

BY  ÌÍÔÛØÚÙ] ÝÈLH[ÑÛXÚÓ[Ê ÌÍÔÛØÚÙ]Ì   ][ÝÚ[^    ][ÝÊB[Y

or you can creat this command with the FF-PAGE-ANALYSER, by choosing the Action: "Click Link" and then right click on the "links[n]" in the treeview and select in the context menu "create command"

_FFOpenURL doesn't return a Socket it returns true if the page is loaded.

Share this post


Link to post
Share on other sites

Hi Stilgar ! How can I control FF options like turn on/off block Image, turn on/off block Pop-up ect ...

Thanks ! :)

P/S : After downloaded your newest FF.au3 (Feb 06) I can't use FF Page Analyzer, it always show cannot open connections to Firefox

Edited by trinitrotoluen

Share this post


Link to post
Share on other sites

Block images OFF:

_FFSetGet($Socket,'Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch).setIntPref("permissions.default.image",1);')oÝ÷ ØhrH¦j¬8Ö®¶­seôde6WDvWBb33cµ6ö6¶WBÂb33´6ö×öæVçG2æ6Æ76W5²gV÷C´Ö÷¦ÆÆæ÷&&VfW&Væ6W2×6W'f6S³gV÷CµÒævWE6W'f6R6ö×öæVçG2æçFW&f6W2æç4&Vd'&æ6ç6WDçE&VbgV÷C·W&Ö76öç2æFVfVÇBæÖvRgV÷C²Ã"²b33²

It's alwas the same, you can look in the about:config and replace e.g. "permissions.default.image" with any other name and change the methode for setting the value:

msIPrefsBranch - MDC

config-entries

- FF Page Analyzer:

Here it works.

The error message is not only for connection problems ... I change this in the next version.

You can try the latest version of the FF.au3 - V0.3.5.7:

FF.au3

Share this post


Link to post
Share on other sites

@wIck3d : http://wiki.github.com/bard/mozrepl

@Stilgar : Hi, on your older FF.au3 version when I disable my connection it can continue work, of course Firefox will show the connection fail but it can't on your newest FF.au3 when I disable my connection

P/s : Some websites FF Page Analyzer can't catch, it always show "ERROR: Can't open connection to FireFox", this is the log of AutoIT.

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "F:\Downloads\FF-Page Analyzer\FF-Page_Analyzer_V0997.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams   
+>12:46:39 Starting AutoIt3Wrapper v.1.10.1.14  Environment(Language:0409  Keyboard:00000409  OS:WIN_XP/Service Pack 3, v.5657  CPU:X86  ANSI)
>Running AU3Check (1.54.14.0)  from:C:\Program Files\AutoIt3
+>12:46:39 AU3Check ended.rc:0
>Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "F:\Downloads\FF-Page Analyzer\FF-Page_Analyzer_V0997.au3"  
_FFConnect: IP: 127.0.0.1
_FFConnect: Port: 4242
_FFConnect: Connection Delay: 6ms
_FFConnect: Socket: 1592
__FFSend: FF_AutoItScript.JavascriptsInstalled
__FFRecv: 1
__FFSend: navigator.userAgent
__FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)
__FFGetBrowserVersion: 3.0
__FFSend: content.wrappedJSObject.frames["top"].document.location.href
__FFRecv: 
__FFWaitForRepl ==> MozRepl Exception: !!! TypeError: content.wrappedJSObject.frames.top is undefined

Details:

  message: content.wrappedJSObject.frames.top is undefined
  fileName: chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/Trinitro%20Toluen/Application%20Data/Mozilla/Firefox/Profiles/t5kkg8jz.TNT/mozrepl.tmp.js
  lineNumber: 1
  stack:
    @chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/Trinitro%20Toluen/Application%20Data/Mozilla/Firefox/Profiles/t5kkg8jz.TNT/mozrepl.tmp.js:1
  name: TypeError

repl>
_FFSetGet ==> Error return value
Edited by trinitrotoluen

Share this post


Link to post
Share on other sites

@trinitrotoluen:

- Which connection do you mean? From a script to FF or from FF to the internet?

Have you a log if it fails?

- Which websites the FF Page Analyzer can't catch?

- From FF to the internet.

- I sent you a pm

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...