Rickname Posted July 9, 2014 Share Posted July 9, 2014 I downloaded FF.au3 , installed MozRepl, started it, put 4242 as port in it, then when Im trying to run this simple script : #include "FF.au3" _FFConnect(default,Default,6000) _FFWindowOpen("http://www.youtube.com", True, True) The thing is, it actually works, but it is still gives me a very annoying error : _FFConnect: OS: WIN_7 WIN32_NT 7601 Service Pack 1 _FFConnect: AutoIt: 3.3.12.0 _FFConnect: FF.au3: 0.6.0.1b-10 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect: Delay: 2ms _FFConnect: Socket: 488 _FFConnect: Browser: Mozilla/5.0 (Windows NT 6.1; rv:30.0) Gecko/20100101 Firefox/30.0 __FFSendJavaScripts: Sending functions to FireFox .......... done _FFWindowOpen: http://www.youtube.com _FFLoadWait: . __FFWaitForRepl ==> Error TCPSend / TCPRecv: TCPRecv :-1 __FFWaitForRepl ==> Error TCPSend / TCPRecv: TCPRecv :-1 . loaded in 573ms [object XrayWrapper [object HTMLDocument]] - {location: {...}, SWFUpload_0: function() {...}, rss_feed: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} _FFWindowGetHandle: 0x00000000 _FFWindowGetHandle ==> General Error What can do ? Link to comment Share on other sites More sharing options...
Iczer Posted July 10, 2014 Share Posted July 10, 2014 See suggested changes in Link to comment Share on other sites More sharing options...
Gonnosuke Posted July 11, 2014 Share Posted July 11, 2014 (edited) I don't know if anyone will find this useful but I recently had to automate a process that required a private browsing session and ended up writing the following function. If anyone knows how to enable private browsing via FFCmd I'd love to know. I tried and failed to get it working properly and ended up with the following method which is probably much slower than it would be if called directly. expandcollapse popup; #INTERNAL_USE_ONLY# ========================================================== ; Name ..........: _FFStartPrivate ; Description ...: Starts Private browsing session ; AutoIt Version : V3.3.10.2 ; Syntax ........: _FFStartPrivate([$sURL = "about:blank"[, $bNewWin = True[, $bPrivSession = True[, $iPort = 4242]]]]) ; Parameter(s): . ; $bNewWin - Optional: (Default = True) : ; $bPrivSession - Optional: (Default = True) : ; $iPort - Optional: (Default = 4242) : ; Return Value: Success - 1 ; Failure - 0 ; @ERROR - ; @EXTENDED - hWnd from Private firefox session ; Date ..........: 6/7/2014 ; ============================================================================== Func _FFStartPrivate($sURL = "about:blank", $bNewWin = True, $bPrivSession = True, $iPort = 4242) Local Const $sFuncName = "_FFStartPrivate" Local $sPrivSession = "" Local $sNewWin = "" If $bPrivSession Then $sPrivSession = "-private-window" If $bNewWin Then $sNewWin = "-new-window" $sURL = '"' & $sURL & '"' Local $sHKLM = 'HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox' If @OSArch <> 'X86' Then $sHKLM = 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox' Local $sFFVerKey = $sHKLM & '\' & RegEnumKey($sHKLM, 1) Local $sFFExe = RegRead($sFFVerKey & '\Main', 'PathToExe') If @error Then SetError(__FFError($sFuncName, $_FF_ERROR_GeneralError, "Error reading registry entry for FireFox." & @CRLF & _ $sFFVerKey & "\Main\PathToExe" & @CRLF & _ "Error from RegRead: " & @error)) Return 0 EndIf Local $sCommand = StringFormat('"%s" %s %s %s "-repl %i"', $sFFExe, $sNewWin, $sPrivSession, $sURL, $iPort) Run($sCommand) Local $sPrivhWnd = WinWaitActive("[REGEXPTITLE:(?i)(.*Private Browsing.*)]", "", 10) Sleep(250) $sCmdWinSelect = 'Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser")' _FFCmd("repl.enter(" & $sCmdWinSelect & ")") WinActivate($sPrivhWnd) SetExtended($sPrivhWnd) If $_FF_COM_TRACE Then ConsoleWrite(@CRLF & '_FFStartPrivate: "' & $sCommand) ConsoleWrite(@CRLF & '_FFStartPrivate hWnd: "' & $sPrivhWnd & @CRLF) EndIf If @error Then SetError(__FFError($sFuncName, $_FF_ERROR_GeneralError, "Error launching Private session.")) Return 0 Else Return 1 EndIf EndFunc ;==>_FFStartPrivate Regards, Gonnosuke Edited July 11, 2014 by Gonnosuke Danp2 1 Link to comment Share on other sites More sharing options...
Danp2 Posted July 12, 2014 Share Posted July 12, 2014 Here's an enhanced version of _FFWindowOpen that supports private browsing. FYI, I have not tested to see how this update may affect other functions. Let me know if you see any issues. expandcollapse popup; #FUNCTION# =================================================================== ; Name ..........: _FFWindowOpen ; Description ...: Opens a new browser window ; Beschreibung ..: Öffnet ein neues Browser Fenster. ; Syntax ........: _FFWindowOpen([$sURL = "about:blank"[, $bActivate = True[, $bLoadWait = True]]]) ; Parameter(s): .: $sURL - Optional: (Default = "about:blank") : ; $bActivate - Optional: (Default = True) ; $bLoadWait - Optional: (Default = True) : ; $bPrivate - Optional: (Default = False) : ; Return Value ..: Success - 1 and sets ; @EXTENDED - Window handle ; Failure - 0 and sets ; @ERROR - ; @EXTENDED - "" ; Author(s) .....: Thorsten Willert ; Date ..........: Fri Nov 13 18:31:06 CET 2009 ; Link ..........: https://developer.mozilla.org/En/DOM/Window, https://developer.mozilla.org/En/NsIWindowMediator ; Related .......: _FFWindowSelect, _FFWindowClose, _FFWindowGetHandle ; Example .......: Yes ; ============================================================================== Func _FFWindowOpen($sURL = "about:blank", $bActivate = True, $bLoadWait = True, $bPrivate = False) Local Const $sFuncName = "_FFWindowOpen" If Not __FFCheckURL($sURL) Then SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(URL) $sURL: " & $sURL)) Return 0 EndIf Local $bTrace = $_FF_COM_TRACE $_FF_COM_TRACE = False ConsoleWrite("_FFWindowOpen: " & $sURL & @CRLF) If $bPrivate Then _FFCmd("window.PrivateBrowsingUtils.privacyContextFromWindow(window).usePrivateBrowsing = true") Else _FFCmd("window.PrivateBrowsingUtils.privacyContextFromWindow(window).usePrivateBrowsing = false") EndIf _FFCmd("window.open('" & $sURL & "');") If $bLoadWait Then _FFLoadWait() If Not @error Then If _FFWindowSelect() Then Local $hWin = @extended If Not @error And $bActivate Then WinActivate($hWin) __FFSendJavaScripts() $_FF_COM_TRACE = $bTrace SetExtended($hWin) Return 1 EndIf EndIf $_FF_COM_TRACE = $bTrace SetExtended("") Return 0 EndFunc ;==>_FFWindowOpen Gonnosuke and 232showtime 2 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Gonnosuke Posted July 18, 2014 Share Posted July 18, 2014 (edited) Thanks Danp2! I was using the wrong context. [Edit] I found a big problem with it -- when you use _FFWindowOpen like above (or if you send keys Ctrl-Shift-P), it creates a private session that really isn't private and I think the reason is that it shares the PID with existing FF windows. For example, the reason I need to use a private session is because I don't want users to be able to save the password information in the browser (among other things). With your function, if I automate the login, do what I need to do, and then close the private session window, the login info is stored when I go back to the site in question. If I use the original function I wrote (which is based on the __FFStartProcess function) it works like it should and the login info isn't stored from session to session. I suspect it's a bug with FF and the way it's initializing the new window. Edited July 18, 2014 by Gonnosuke Link to comment Share on other sites More sharing options...
Mike25de Posted July 31, 2014 Share Posted July 31, 2014 Maybe is just me being stupid... but is this UDF compatible with Firefox 30? Or maybe MozRepl is not compatible with my Firefox. Anyone using this FF.au3 at the moment? Thanks in advance. Link to comment Share on other sites More sharing options...
Danp2 Posted July 31, 2014 Share Posted July 31, 2014 Yes, it's working fine. What issues are you having? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
doinguyen Posted August 4, 2014 Share Posted August 4, 2014 Dear, I have issue when i run file .au3 include <FF.au3> & <FF_AutoLogin.au3> that is ok, but when run file .exe ( compile from file .au3 ) then error.. Please help me.. Tks a lot Link to comment Share on other sites More sharing options...
doinguyen Posted August 9, 2014 Share Posted August 9, 2014 Anybody dont have that issue ? Link to comment Share on other sites More sharing options...
jchd Posted August 9, 2014 Share Posted August 9, 2014 Which AutoIt version are you using? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
doinguyen Posted August 9, 2014 Share Posted August 9, 2014 I use ver 3.3.12. Last i use ver 3.3.6.1 so normail Tks Jchd reply Link to comment Share on other sites More sharing options...
Danp2 Posted August 9, 2014 Share Posted August 9, 2014 Have you tried >this solution? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
doinguyen Posted August 10, 2014 Share Posted August 10, 2014 Have you tried >this solution? Thanks Danp2 so much... That solution fix my issue Link to comment Share on other sites More sharing options...
JWW Posted August 21, 2014 Share Posted August 21, 2014 Does anyone have an updated FF.au3 with all of the changes/updates that have been provided to fix it? The ones I have found and changed: Thanks! Btw, I have attached mine with the above changes in case anyone wants to use it. Well, I don't see an option to attach, so here's a Dropbox link: https://www.dropbox.com/s/a82h566y3c3x2r3/FF.au3 John AutoFan 1 Link to comment Share on other sites More sharing options...
AutoFan Posted September 22, 2014 Share Posted September 22, 2014 (edited) I needed to add in the __FFStartProcess func in order to make it works Local $sFFExe = RegRead($sHKLM & "" & RegRead($sHKLM, "CurrentVersion") & "Main", "PathToExe") Edited September 22, 2014 by AutoFan Link to comment Share on other sites More sharing options...
AutoFan Posted September 23, 2014 Share Posted September 23, 2014 Is there any function for removing all cookies ? Link to comment Share on other sites More sharing options...
Danp2 Posted September 23, 2014 Share Posted September 23, 2014 Yes... See >this post from earlier in this same thread. AutoFan 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AutoFan Posted September 24, 2014 Share Posted September 24, 2014 Hi, how to get id by textContent ? eg : <id="gt200">Something here</> I tried _FFXPath('//*[@textContent="Something here"]',"id") but it didn't work Link to comment Share on other sites More sharing options...
Rickname Posted September 29, 2014 Share Posted September 29, 2014 (edited) I can't retrieve the Handle of the window ive opened with the _FFWindowOpen function. The function works, the window starts, but everytime in console it says : _FFWindowGetHandle: 0x00000000 _FFWindowGetHandle ==> General Error What can I do ? Edited September 29, 2014 by Rickname Link to comment Share on other sites More sharing options...
MikahS Posted September 29, 2014 Share Posted September 29, 2014 1. The "Update" regarding WindowOpen function to open a Private window, it doesn't work ! Still a normal window is appearing. 2. A even bigger problem is that I can't retrieve the Handle of the window ive opened with the _FFWindowOpen function. The function works, the window starts, but everytime in console it says : What can I do ? Post your code, please. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now