Jump to content

Automate firefox


Bert
 Share

Recommended Posts

  • Replies 251
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Ok that fixed it. But I would sometimes randomly get an error with the _FFOpenUrl function (I think). Like I use that function and the page wouldn't load at all and there would be an _FFCmd_Err. It doesn't happen all the time, only onces every little while, but that's what's frustrating because it would stop working while I'm away from the computer when I can't fix it manually. Here's my code and the output:

openurl_error.txt

Edited by crazydude
Link to comment
Share on other sites

Ok that fixed it. But I would sometimes randomly get an error with the _FFOpenUrl function (I think). Like I use that function and the page wouldn't load at all and there would be an _FFCmd_Err. It doesn't happen all the time, only onces every little while, but that's what's frustrating because it would stop working while I'm away from the computer when I can't fix it manually. Here's my code and the output:

openurl_error.txt

Was at this moment (_FFConnect) any other FF-window open? A popup from an addon, or the download-manager ...?

Have you tried it with the latest version, too? (0.5.3.3b-0)

FF.au3

Link to comment
Share on other sites

Well I have set it up so that my regular FF is using port 4242 and Flock is using port 4243, with no more than 1 window each. And no pop ups from Flock as I only got it for this purpose with no addons except Adblock and Mozrepl. But I find that this usually happens at first startup when the browser is fresh, and to fix it I usually have to manually go to an address (using default homepage doesnt help). I will restart my comp and see if I can replicate it using the newest version.

Edited by crazydude
Link to comment
Share on other sites

Hmm, I sometimes would get this error:

CODE
>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\Johnny\Documents\scripts\mh.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>19:47:18 Starting AutoIt3Wrapper v.1.10.1.14 Environment(Language:0409 Keyboard:00000409 OS:WIN_VISTA/Service Pack 1 CPU:X86 ANSI)

>Running AU3Check (1.54.14.0) from:C:\Program Files\AutoIt3

+>19:47:19 AU3Check ended.rc:0

>Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\Johnny\Documents\scripts\mh.au3"

_FFConnect: OS: WIN_VISTA WIN32_NT 6001 Service Pack 1

_FFConnect: AutoIt: 3.3.0.0

_FFConnect: FF.au3: 0.5.3.3b-0

_FFConnect: IP: 127.0.0.1

_FFConnect: Port: 4242

_FFConnect: Delay: 2ms

_FFConnect: Socket: 668

_FFCmd ==> Error return value: _FFCmd_Err

_FFOpenURL: http://search.freecause.com/search?ourmark...mp;p=fkji8bm7il

__FFSend: try{window.content.document.location.href="http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p=fkji8bm7il";}catch(e){'_FFCmd_Err';};

_FFConnect ==> General Error: Tried to connect to a non browser-window

__FFRecv: _FFCmd_Err

__FFSend: try{window.content.wrappedJSObject.document.location.href="http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p=fkji8bm7il";}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFCmd ==> Error return value: _FFCmd_Err

_FFLoadWait: _FFOpenURL ==> No match: http://search.freecause.com/search?ourmark...mp;p=fkji8bm7il

._FFCmd ==> Error return value: _FFCmd_Err

loaded in 420ms

_FFCmd ==> Error return value: _FFCmd_Err

__FFSend: try{window.content.document.documentElement.textContent;}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

__FFSend: try{window.content.wrappedJSObject.document.documentElement.textContent;}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFOpenURL: http://search.freecause.com/search?ourmark...&p=g2kby5un 3xd2e9wpme

__FFSend: try{window.content.document.location.href="http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p=g2kby5un 3xd2e9wpme";}catch(e){'_FFCmd_Err';};

_FFCmd ==> Error return value: _FFCmd_Err

__FFRecv: _FFCmd_Err

__FFSend: try{window.content.wrappedJSObject.document.location.href="http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p=g2kby5un 3xd2e9wpme";}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFCmd ==> Error return value: _FFCmd_Err

_FFLoadWait: _FFOpenURL ==> No match: http://search.freecause.com/search?ourmark...&p=g2kby5un 3xd2e9wpme

._FFCmd ==> Error return value: _FFCmd_Err

loaded in 422ms

_FFCmd ==> Error return value: _FFCmd_Err

__FFSend: try{window.content.document.documentElement.textContent;}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

__FFSend: try{window.content.wrappedJSObject.document.documentElement.textContent;}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFOpenURL: http://search.freecause.com/search?ourmark...58819&p=zap 5jpfvm

__FFSend: try{window.content.document.location.href="http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p=zap 5jpfvm";}catch(e){'_FFCmd_Err';};

_FFCmd ==> Error return value: _FFCmd_Err

__FFRecv: _FFCmd_Err

__FFSend: try{window.content.wrappedJSObject.document.location.href="http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p=zap 5jpfvm";}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFCmd ==> Error return value: _FFCmd_Err

_FFLoadWait: _FFOpenURL ==> No match: http://search.freecause.com/search?ourmark...58819&p=zap 5jpfvm

._FFCmd ==> Error return value: _FFCmd_Err

loaded in 420ms

_FFCmd ==> Error return value: _FFCmd_Err

__FFSend: try{window.content.document.documentElement.textContent;}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

__FFSend: try{window.content.wrappedJSObject.document.documentElement.textContent;}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

Link to comment
Share on other sites

Hmm, I sometimes would get this error:

CODE
>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\Johnny\Documents\scripts\mh.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>19:47:18 Starting AutoIt3Wrapper v.1.10.1.14 Environment(Language:0409 Keyboard:00000409 OS:WIN_VISTA/Service Pack 1 CPU:X86 ANSI)

>Running AU3Check (1.54.14.0) from:C:\Program Files\AutoIt3

+>19:47:19 AU3Check ended.rc:0

>Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\Johnny\Documents\scripts\mh.au3"

_FFConnect: OS: WIN_VISTA WIN32_NT 6001 Service Pack 1

_FFConnect: AutoIt: 3.3.0.0

_FFConnect: FF.au3: 0.5.3.3b-0

_FFConnect: IP: 127.0.0.1

_FFConnect: Port: 4242

_FFConnect: Delay: 2ms

_FFConnect: Socket: 668

_FFCmd ==> Error return value: _FFCmd_Err

_FFOpenURL: http://search.freecause.com/search?ourmark...mp;p=fkji8bm7il

__FFSend: try{window.content.document.location.href="http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p=fkji8bm7il";}catch(e){'_FFCmd_Err';};

_FFConnect ==> General Error: Tried to connect to a non browser-window

__FFRecv: _FFCmd_Err

__FFSend: try{window.content.wrappedJSObject.document.location.href="http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p=fkji8bm7il";}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFCmd ==> Error return value: _FFCmd_Err

_FFLoadWait: _FFOpenURL ==> No match: http://search.freecause.com/search?ourmark...mp;p=fkji8bm7il

._FFCmd ==> Error return value: _FFCmd_Err

loaded in 420ms

_FFCmd ==> Error return value: _FFCmd_Err

__FFSend: try{window.content.document.documentElement.textContent;}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

__FFSend: try{window.content.wrappedJSObject.document.documentElement.textContent;}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFOpenURL: http://search.freecause.com/search?ourmark...&p=g2kby5un 3xd2e9wpme

__FFSend: try{window.content.document.location.href="http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p=g2kby5un 3xd2e9wpme";}catch(e){'_FFCmd_Err';};

_FFCmd ==> Error return value: _FFCmd_Err

__FFRecv: _FFCmd_Err

__FFSend: try{window.content.wrappedJSObject.document.location.href="http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p=g2kby5un 3xd2e9wpme";}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFCmd ==> Error return value: _FFCmd_Err

_FFLoadWait: _FFOpenURL ==> No match: http://search.freecause.com/search?ourmark...&p=g2kby5un 3xd2e9wpme

._FFCmd ==> Error return value: _FFCmd_Err

loaded in 422ms

_FFCmd ==> Error return value: _FFCmd_Err

__FFSend: try{window.content.document.documentElement.textContent;}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

__FFSend: try{window.content.wrappedJSObject.document.documentElement.textContent;}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFOpenURL: http://search.freecause.com/search?ourmark...58819&p=zap 5jpfvm

__FFSend: try{window.content.document.location.href="http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p=zap 5jpfvm";}catch(e){'_FFCmd_Err';};

_FFCmd ==> Error return value: _FFCmd_Err

__FFRecv: _FFCmd_Err

__FFSend: try{window.content.wrappedJSObject.document.location.href="http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p=zap 5jpfvm";}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFCmd ==> Error return value: _FFCmd_Err

_FFLoadWait: _FFOpenURL ==> No match: http://search.freecause.com/search?ourmark...58819&p=zap 5jpfvm

._FFCmd ==> Error return value: _FFCmd_Err

loaded in 420ms

_FFCmd ==> Error return value: _FFCmd_Err

__FFSend: try{window.content.document.documentElement.textContent;}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

__FFSend: try{window.content.wrappedJSObject.document.documentElement.textContent;}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

Hello,

what do you mean with "sometimes"? On which situation?

Which browser-version do you have? Which MozRepl version? How does your script look like?

This line:

_FFConnect ==> General Error: Tried to connect to a non browser-window

means you try to connect to an other FF-window which is open, like download-manager, a message window ... so all other functions fails.

Link to comment
Share on other sites

This is my script:

For $i = 0 To 5
    TraySetToolTip("Current: "&String($i))
    FileChangeDir("E:\FF\FirefoxPortable"&String($i)&"\")
    Run("FirefoxPortable.exe")
    WinSetState("Mozilla Firefox", "", @SW_MINIMIZE)
    Sleep(1000)
    _FFConnect("127.0.0.1", 4242) 
    For $n = 1 To 12
        _FFOpenUrl("http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p="&randstr())
        _FFLoadWait()
        Sleep(1000)
    Next
    _FFDisConnect()
    Sleep(3000)
    WinClose("Mozilla Firefox")
    ProcessWaitClose("firefox.exe")
    Sleep(1000)
Next

It opens firefox portable from one of the directories and then goes on to performing searches with random strings (randstr returns a random string). By "sometimes" i mean, out of the 6 loops, sometimes all of them work (i would search 12 times and then close the browser), sometimes 1 or 2 dont work. And I have no download managers installed on the computer, so it can't be that.

And the version of Mozrepl is 1.0.0.2009041717

Edited by oxnume
Link to comment
Share on other sites

This is my script:

For $i = 0 To 5
    TraySetToolTip("Current: "&String($i))
    FileChangeDir("E:\FF\FirefoxPortable"&String($i)&"\")
    Run("FirefoxPortable.exe")
    WinSetState("Mozilla Firefox", "", @SW_MINIMIZE)
    Sleep(1000)
    _FFConnect("127.0.0.1", 4242) 
    For $n = 1 To 12
        _FFOpenUrl("http://search.freecause.com/search?ourmark=1&fr=freecause&ei=utf-8&type=58819&p="&randstr())
        _FFLoadWait()
        Sleep(1000)
    Next
    _FFDisConnect()
    Sleep(3000)
    WinClose("Mozilla Firefox")
    ProcessWaitClose("firefox.exe")
    Sleep(1000)
Next

It opens firefox portable from one of the directories and then goes on to performing searches with random strings (randstr returns a random string). By "sometimes" i mean, out of the 6 loops, sometimes all of them work (i would search 12 times and then close the browser), sometimes 1 or 2 dont work. And I have no download managers installed on the computer, so it can't be that.

And the version of Mozrepl is 1.0.0.2009041717

It could be that the time between run and _FFConnect is to short and the browser is not full ready.

You can look in the FF.au3 at the __FFStartProcess function as example.

With download manager I mean the FF-download-manager window, but I think it's more timing problem.

Link to comment
Share on other sites

I can't use the _FFStart because the portable firefox is not registered in the registry. I never download anything with them so the download manager never shows up, I just use them for only this purpose. I'll try setting the delay longer(maybe 2000? my computer is pretty fast), hopefully that works.

Link to comment
Share on other sites

I can't use the _FFStart because the portable firefox is not registered in the registry. I never download anything with them so the download manager never shows up, I just use them for only this purpose. I'll try setting the delay longer(maybe 2000? my computer is pretty fast), hopefully that works.

I've not said you should use _FFStart I said look at "__FFStartProcess"-code in the FF.au3 and take it as example how I'm starting the firefox.exe.

2000ms could work, depending on the other things your computer do at this time.

Edited by Stilgar
Link to comment
Share on other sites

Hey I was wondering how do you install the mozrepl? I would like to use this but without that I don't think it can work. I have the latest version of firefox if you were wondering.

Link to comment
Share on other sites

Hey I was wondering how do you install the mozrepl? I would like to use this but without that I don't think it can work. I have the latest version of firefox if you were wondering.

I've installed it like any other FF-AddOn.

Just click on the link with the XPI (MozRepl 1.0 release) and install it:

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

^_^

Link to comment
Share on other sites

Yes yes! Example plzz!

That's simple:

#region Includes
#include <FF.au3>
#endregion Includes

_FFConnect()

If _FFIsConnected() Then
    ; Config entries:
    ; http://kb.mozillazine.org/about:config_entries

    _FFPrefSet("network.proxy.type",1) ; 1 = Manual proxy configuration

    ; http proxy
    _FFPrefSet("network.proxy.http", "192.168.0.199") ; http proxy
    _FFPrefSet("network.proxy.http_port", 8080) ; http proxy port

    ; Socks configuration
    _FFPrefSet("network.proxy.socks" ,"192.168.0.198") ; socks
    _FFPrefSet("network.proxy.socks_port", 80) ; socks port
    _FFPrefSet("network.proxy.socks_version", 4) ; socks version

    ; reset all to default values:
    #cs
    _FFPrefReset("network.proxy.type")
    _FFPrefReset("network.proxy.http")
    _FFPrefReset("network.proxy.http_port")
    _FFPrefReset("network.proxy.socks")
    _FFPrefReset("network.proxy.socks_port")
    _FFPrefReset("network.proxy.socks_version")
    #ce

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