Jump to content

Automate firefox


Bert
 Share

Recommended Posts

Hi,

Yes, same error on the same page.

I have 2 question :

1. Can I load the page but don't let the browser appear anything (picture,text,banner...) ? I think it will improve the speed for unload unimportant page.

2.What's difference between _FFaction("find") and _FFSearch ?

thx !

Edit : Can you give me some documents for content.find(), many thanks !

Edited by trinitrotoluen
Link to comment
Share on other sites

  • Replies 251
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

Yes, same error on the same page.

I have 2 question :

1. Can I load the page but don't let the browser appear anything (picture,text,banner...) ? I think it will improve the speed for unload unimportant page.

2.What's difference between _FFaction("find") and _FFSearch ?

thx !

Edit : Can you give me some documents for content.find(), many thanks !

- Can you tell me page, please? I tried yesterday _FFSearch on different pages, thousands of times and I never had an error like that and the search results where never wrong ...

1. You can disable the picture loading but not the whole page rendering:

; Block images OFF:
_FFPrefSet($Socket,"permissions.default.image",1)
; Block images ON:
_FFPrefSet($Socket,"permissions.default.image",2)

2. Have you tried it? _FFaction("find") only opens the search dialog.

3. MDC - find()

Link to comment
Share on other sites

- Can you tell me page, please? I tried yesterday _FFSearch on different pages, thousands of times and I never had an error like that and the search results where never wrong ...

1. You can disable the picture loading but not the whole page rendering:

; Block images OFF:
_FFPrefSet($Socket,"permissions.default.image",1)
; Block images ON:
_FFPrefSet($Socket,"permissions.default.image",2)

2. Have you tried it? _FFaction("find") only opens the search dialog.

3. MDC - find()

Thank you for MDC - find() link. I don't remeber the page, but I'm sure it in my bookmark, I will try again and send you soon.

Link to comment
Share on other sites

Hi,

@Stilgar: Can you review _FFFormOptionselect function. I think it doesn't work.

I used ur example but it not work too.

$Socket = _FFStart("http://de.selfhtml.org/javascript/objekte/anzeige/option_value.htm")
_FFFormOptionselect($Socket, "Auswahl", "name", "Bingo - gewonnen!", "value")
Link to comment
Share on other sites

Hi,

@Stilgar: Can you review _FFFormOptionselect function. I think it doesn't work.

I used ur example but it not work too.

$Socket = _FFStart("http://de.selfhtml.org/javascript/objekte/anzeige/option_value.htm")
_FFFormOptionselect($Socket, "Auswahl", "name", "Bingo - gewonnen!", "value")
Hi,

ok there's a problem. I'll fix this with the next update.

Workaround for it:

_FFSetGet($Socket,'window.content.frames["top"].document.forms[0].elements[0].options[4].selected=true')
; OR
_FFXPath($Socket,"//form[@name='Testform']//select[@name='Auswahl']//option[@value='Bingo - gewonnen!']","selected=true",5)
Edited by Stilgar
Link to comment
Share on other sites

Thank you very much.

Can you check Function _FFLoadWait again, i think it work not good. I used that function but it couldn't wait untill the page loaded. And i think the function _FFFormRadioButton have problem too, i think it wrong with type=checkbox. I edited that function with type=radio and it work good.

Sorry about my English.

Link to comment
Share on other sites

@longnhi:

Where do have problems with _FFLoadWait? Can you show me an example, please.

The problem with _FFFormRadioButton is fixed. I rebuild the function _FFFormCheckBox and forget that _FFFormRadioButton was based on it :D

There's the (last) update for the "old" version of the FF.au3:

FF.au3

And there's the new one (without $Socket-parameters) to test:

FF.au3 V0.5.0.0

Changelog

Example for V0.5.0.0:

#include <FF.au3>

If _FFConnect() Then
    _FFTabAdd("google.com")

    If _FFObjCreate("google", "window.content.document") Then
        MsgBox(64, "Cookie", _FFObj("google.cookie"))
        MsgBox(64, "Domain", _FFObj("google.domain"))
        _FFObjDelete("google")
    EndIf

    _FFTabClose("Google","label")
EndIf

Exit
;===============================================================================
Func _FFObj($sObject)
    $RetVal = _FFSetGet("try{FF_AutoItScript." & $sObject & ";}catch(e){'Err'};")
    If Not @error And $RetVal <> "Err" Then
        Return $RetVal
    Else
        SetError(1)
        Return 0
    EndIf
EndFunc   ;==>_FFObj
;===============================================================================
Func _FFObjCreate($sNewObject, $sObject)
    If StringRegExp($sNewObject, "[\W]+") Then Return 0
    $RetVal = _FFSetGet("try{FF_AutoItScript." & $sNewObject & "=" & $sObject & "}catch(e){};FF_AutoItScript." & $sNewObject & " ? 1 : 0;")
    SetError(Number($RetVal))
    Return $RetVal
EndFunc   ;==>_FFObjCreate
;===============================================================================
Func _FFObjDelete($sObject)
    Return _FFSetGet("delete FF_AutoItScript." & $sObject & ";!FF_AutoItScript." & $sObject & " ? 1 : 0;")
EndFunc   ;==>_FFObjDelete
Edited by Stilgar
Link to comment
Share on other sites

__FFStartProcess: ""C:\Program Files\Mozilla Firefox\firefox.exe" -new-window "http://www.google.com" -repl 4242

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3

_FFConnect: AutoIt: 3.3.0.0

_FFConnect: FF.au3: 0.5.0.0b-0

_FFConnect: IP: 127.0.0.1

_FFConnect: Port: 4242

_FFConnect: Delay: 2ms

_FFConnect ==> Timeout: Can not connect to FireFox/MozRepl on: 127.0.0.1:4242

_FFLoadWait: . __FFSend ==> Error TCPSend / TCPRecv: TCPSend: window.getBrowser().webProgress.isLoadingDocument

__FFSend ==> Error TCPSend / TCPRecv: TCPSend: window.getBrowser().webProgress.busyFlags

loaded in 0ms

This is what i got when i use this line of code.

#include <ff.au3>

$Socket = _FFStart("http://www.google.com")
Link to comment
Share on other sites

@JinQi:

It looks like you haven't MozRepl installed.

[EDIT]

In V0.5.0.0b-0 the var $Socket (and all parameters for it) isn't used, anymore. It's replaced by the global variable $_FF_GLOBAL_SOCKET.

But you only have to use it, if you wanna more then one connections to FireFox in your script.

Edited by Stilgar
Link to comment
Share on other sites

__FFStartProcess: ""C:\Program Files\Mozilla Firefox\firefox.exe" -new-window "http://www.google.com" -repl 4242

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3

_FFConnect: AutoIt: 3.3.0.0

_FFConnect: FF.au3: 0.5.0.0b-0

_FFConnect: IP: 127.0.0.1

_FFConnect: Port: 4242

_FFConnect: Delay: 2ms

_FFConnect: Socket: 1684

__FFSend: navigator.userAgent

__FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)

_FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)

_FFSendJavascripts: Sending functions to FireFox ........... done

_FFLoadWait: . __FFSend ==> Error TCPSend / TCPRecv: TCPSend: window.getBrowser().webProgress.isLoadingDocument

__FFSend ==> Error TCPSend / TCPRecv: TCPSend: window.getBrowser().webProgress.busyFlags

loaded in 0ms

Here comes the second error. :D

Link to comment
Share on other sites

__FFStartProcess: ""C:\Program Files\Mozilla Firefox\firefox.exe" -new-window "http://www.google.com" -repl 4242

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3

_FFConnect: AutoIt: 3.3.0.0

_FFConnect: FF.au3: 0.5.0.0b-0

_FFConnect: IP: 127.0.0.1

_FFConnect: Port: 4242

_FFConnect: Delay: 2ms

_FFConnect: Socket: 1684

__FFSend: navigator.userAgent

__FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)

_FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)

_FFSendJavascripts: Sending functions to FireFox ........... done

_FFLoadWait: . __FFSend ==> Error TCPSend / TCPRecv: TCPSend: window.getBrowser().webProgress.isLoadingDocument

__FFSend ==> Error TCPSend / TCPRecv: TCPSend: window.getBrowser().webProgress.busyFlags

loaded in 0ms

Here comes the second error. :D

Ok I found the problem, I'll upload a new version the next hour.

@longnhi:

I, see. I must try this.

Link to comment
Share on other sites

You can use the 0.4.x version, it is more complete.

Why do mean this?

The only differenz to V0.4.x is: in V0.5.x you don't have to use the Socket-parameter in every function.

[EDIT]

I've uploaded a new version with a fixed URL handling (_FFStart, _FFOpenURL, _FFTabAdd...)

FF.au3

Edited by Stilgar
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...