# Latest/Easiest/Best way of controlling Firefox?

## Recommended Posts

I'm trying to determine the latest/easiest/best way (as of May 2016) to control & interact with Firefox using Autoit.

To the best I've been able to determine, there have been two different ways to do this. Once upon a time, there was something called "Mozilla ActiveX control", but given all the security warnings I receive whenever I try to download it (the original host site appears to be absent or invalid), I'd prefer to avoid it. The other approach is/was to use a UDF called "FF.au3" developed -- but apparently no longer supported for English speakers -- by Stilgar (old thread is here: https://www.autoitscript.com/forum/topic/95595-ffau3-v0601b-10/). The most recent thread I could find (in English) was started by Danp2 here: https://www.autoitscript.com/forum/topic/167661-ffau3-v0601b-15/

Although it certainly seems like using the FF UDF is the most recent and possibly only still-valid approach, getting anything sufficiently useful done with it strikes me as rather difficult, in part because the English documentation is so incomplete as to be unhelpful (and apparently incorrect as well), but also because it appears that to accomplish what I need to do might well require intimate knowledge of Firefox internals or APIs (maybe XULs too).  For example, there are functions such as _FFCmd() that takes arbitrary/undocumented strings, and _FFGetValue() and_FFSetValue() with no English documentation at all (besides the minimal function descriptions in the FF.au3 file itself).

So, my question is: What is the latest and/or easiest and/or best way of interacting with Firefox using Autoit?  And what else do I need to learn first in order to use it effectively (such as Firefox developer APIs, etc)?

Thanks!

Edited by Mbee
##### Share on other sites

let me offer my personal preferences for web automation:

first - use IE. are you locked on to Firefox? the built-in IE UDF makes IE automation quite easy, plus the advantage of no-one using IE for regular browsing, so you have a considerable amount of freedom to configure it to your needs, and even work with a hidden sessions, for headless automation purposes - so user workflow is not impacted.

(yeah, i know - i never thought i'd actually recommend IE... )

there is only one downside to automating IE - automation of download is not possible. this is a "security feature" set by Microsoft.

second - manipulate a 3rd-party engine. you can install the iMacro extension for Filefox. this is a scripting engine designed for browser automation, so the downside is that you need to learn the syntax (not too hard), but the upside is that it is a very capable engine, able to easily operate controls that other methods find difficult. use AutoIt to write the iMacro script at run time, launch the extension to execute the script, and collect the returned information or error.

(note: there are iMacro extensions for Chrome and IE too. the extension only is free, look at the bottom of the download page).

finally - use the FF UDF. if IE and iMacro won't cut it - then i find the FF UDF the best approach.

##### Share on other sites

IUIAutomation -

It was a bit hard for me to grasp it and start to use it for some simple tasks but it seems to work well.  The best thing about learning it is how versatile it is.

It may or may not have all the capabilities you need, but its worth looking at.

##### Share on other sites

As far as the FF UDF is concerned I think Stilgar is still developing this UDF.
http://www.thorsten-willert.de/index.php/software/autoit/ff-au3

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2021-06-14 - Version 1.6.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2021-07-20 - Version 1.0.0.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

## Create an account

Register a new account

• ### Similar Content

• By Sanja
Hello forum,
I have the problem that I can not use Firefox in combination with WebDriver when using AutoIt on some websites. Of course it does not work with the very website I need it to work with.
As soon as I want to open the desired website, I get the little robot icon which tells me that the "browser is under remote control" and the website stays blank.
I CAN open the website (www.ebay-kleinanzeigen.de) but I get blocked when I want to go to my account, to be precise.

I am using AutoIt 3.3.14.5 I have checked my FireFox version. It is up to date. Also the special browser drivers like gecko etrc. are up to date too and everything works fine with the WebDriver demo.
It seems that another user also had the same problem, but the thread has already been closed and the users solution (setting security lower did not work for me).
I mean I can only choose between "standard", "strict" and "customized". On "customized I unchecked everything but it still would not change anything.
I also have checked Google Chrome and MS Edge. Same result.
I tried swiching profiles (only with FireFox). Same result.
I tried to acess a previously opened FireFox session where I manually logged in by using this code snippet:
_WD_Option('Driver', 'C:\Path\to\the\executable\geckodriver.exe') _WD_Option('DriverParams', '--log trace --connect-existing  --marionette-port 2828') _WD_Option('Port', 4444) Obviously I adjusted the path of the geckodriver.exe but it did not work at all on my computer.
So far my code is really basically nothing but I can not even start to code. I myself am not a real coder and I know only the very basics like loops, conditions and variables.
----------------------------------------
; Script Start #include <Array.au3> #include <AutoItConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <StaticConstants.au3> #include "wd_core.au3" #include "wd_helper.au3" #include <WindowsConstants.au3> Local $sDesiredCapabilities,$sSession, $sElement SetupGecko()$_WD_DEBUG = $_WD_DEBUG_None _WD_Startup()$sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.ebay-kleinanzeigen.de/m-meine-anzeigen.html?sort=CREATION_DATE_ASC&keyword=winter") Exit Func SetupGecko() _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace --marionette-port 2828') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' & "C:/Users/myaccount/AppData/Roaming/Mozilla/Firefox/Profiles/0123456.default-release" & '"],"log": {"level": "trace"}}}}}' EndFunc ;==>SetupGecko Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"')$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"]}}}}' EndFunc ;==>SetupChrome Func SetupEdge() _WD_Option('Driver', 'msedgedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\msedge.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"binary": "' & StringReplace(@ProgramFilesDir, "\", "/") & '/Microsoft/Edge/Application/msedge.exe", "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false}}}}' EndFunc ;==>SetupEdge -------------------------------------- I left the three setup functions in, because I do not care what browser I use as long as I can start coding. Also, please understand that I am not trying to be lazy here. I do not want someone to code for me. Maybe the problem is very basic, but I just do not know how to eliminate that restriction. Is it something I need to uncheck in the browser settings or is it more complicated? If you need more information, I will be happy to provide those. If somebody has an idea or a solution, I would very much appreciate it. Edit: I am not bothered by the robot icon itself. I do not care about it. If I try to acess my regular ebay account: "https://mesg.ebay.de/mesgweb/ViewMessages/0" it works like a charm despite the notification that the browser is remotely controlled. My problem is, that the first website does not load for some reason ONLY when the browser is remote controlled. • By FUD hello please i need help i need to open link in default browser only one windows without duplicate if i try to open the same link thanks • Hi all, I´m trying to use the command "WD_LoadWait" because I want to pause the script until the web page fully loads in Firefox but I don´t know how to use it. Here´s the full help ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WD_LoadWait ; Description ...: Wait for a browser page load to complete before returning ; Syntax ........: _WD_LoadWait($sSession[, $iDelay = 0[,$iTimeout = -1[, $sElement = '']]]) ; Parameters ....:$sSession - Session ID from _WDCreateSession ; $iDelay - [optional] Milliseconds to wait before checking status ;$iTimeout - [optional] Period of time to wait before exiting function ; $sElement - [optional] Element ID to confirm DOM invalidation ; Return values .: Success - 1 ; Failure - 0 and sets the @error flag to non-zero ; Author ........: Dan Pollak ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WD_LoadWait($sSession, $iDelay = Default,$iTimeout = Default, $sElement = Default) Local Const$sFuncName = "_WD_LoadWait" Local $iErr,$sResponse, $oJSON,$sReadyState   If $iDelay = Default Then$iDelay = 0 If $iTimeout = Default Then$iTimeout = $_WD_DefaultTimeout If$sElement = Default Then $sElement = "" If$iDelay Then Sleep($iDelay) Local$hLoadWaitTimer = TimerInit()   While True If $sElement <> '' Then _WD_ElementAction($sSession, $sElement, 'name') If$_WD_HTTPRESULT = $HTTP_STATUS_NOT_FOUND Then$sElement = '' Else $sResponse = _WD_ExecuteScript($sSession, 'return document.readyState', '') $iErr = @error If$iErr Then ExitLoop EndIf   $oJSON = Json_Decode($sResponse) $sReadyState = Json_Get($oJSON, "[value]")   If $sReadyState = 'complete' Then ExitLoop EndIf If (TimerDiff($hLoadWaitTimer) > $iTimeout) Then$iErr = $_WD_ERROR_Timeout ExitLoop EndIf Sleep(100) WEnd If$iErr Then Return SetError(__WD_Error($sFuncName,$iErr, ""), 0, 0) EndIf   Return SetError($_WD_ERROR_Success, 0, 1) EndFunc Any sugestions or examples? • By water Internet Explorer is nearly dead, newer versions of Firefox can't any longer be automated using Stilgar's FF UDF. Hence more and more users (including me) need to look at automating Webbrowsers using WebDriver. That's why I have started to create a tutorial in the wiki. It should describe all necessary steps from intallation to usage. I'm still collecting ideas for the tutorial - that's where you come into play. What do you expect to see in such a tutorial? Which browsers should be covered (Firefox, Chrome and Edge are settled)? Any questions for the FAQ? Which (high level) coding examples do you expect (like "How to attach to a running browser instance") ... Like to see your comments ToDo-List: Add "Tools" section and add ChroPath plugin. Done. FAQ: "How to attach to a running browser instance". Done. Explain the difference between iuiautomation, iaccessible, autoit, webdriver. Done. The AutoIt FAQ 40 has been extended. Detailed description of each function. Done Example for "how to deal with downloading". Use function _WD_DownloadFile. Example for "how to deal with popups (alerts, print or save dialog). Use function_WD_AlertRespond to respond to a user prompt. Example for "how to deal with multiple tabs". Use functions _WD_NewTab (create a new tab), _WD_Window (close or switch to a tab) and _WD_Attach (attach to existing tab). • By ThePoro Hi everyone. I want to ask about this : I want it runs from 1 to 100 and It opens 10 firefox profiles then access youtube. After I close a firefox window, the loop runs and wait for another window close until loop ends I have a loop like this. Func launch() Local$from = Int(GUICtrlRead($input1)) Local$to = Int(GUICtrlRead($input2)) If$to <> "" Then While $from <=$to Local $profile =$to _RunDos("start firefox.exe -p " & $profile & " -no-remote youtube.com")$to=$to+1 WEnd Else Local$profile = $to _RunDos("start firefox.exe -p " &$profile & " -no-remote youtube.com") EndIf EndFunc Is there any solution?
Thank you!
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...