Jump to content

Recommended Posts

Posted

Hi there,

 

I´m new to Autoit so I'm trying to use the following code in Firefox but I when I run it, it always start Internet Explorer.

 

What I want to do is open a new tab in firefox and wait until it finishes loading before continuing with the script.

 

Any ideas?

Thanks.

 

#include <IE.au3>
$oIE = _IECreate()
_IENavigate($oIE, "www.autoitscript.com")
  • Moderators
Posted

@picorico2 welcome to the forum. The Wiki is a great tool if you are wondering about support for different systems. There are several items out there regarding working with Firefox:

https://www.autoitscript.com/wiki/User_Defined_Functions#Browsers

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted (edited)

Hello @picorico2, The IE library only works with Internet Explorer. If you are looking to automate FireFox I would suggest looking into  UIA or WebDriver. 

UIA is easier to setup then WebDriver but WebDriver is faster and more reliable. 

UIA link: 

WebDriver Link:

Welcome to the forum I hope you find what you are looking for. 

Note: UIA has an example script for automating Firefox.

Here is an example from that script of what you are trying to do. 

const $cToolbarByName = "name:=Navigatiewerkbalk"
const $cAddressBarByName = "name:=((Search or enter address)|(Voer zoekterm of adres in))"
const $cFFNewTabByName="name:=((Open a new tab.*)|(Een nieuw tabblad openen.*))"
const $cstrDocument="Name:=" & "AutoIt.*" & "; controltype:=" & $UIA_DocumentControlTypeId & "; isoffscreen:=False"

;~ Find the FF window
local $oFF=_UIA_getFirstObjectOfElement($UIA_oDesktop,"class:=MozillaWindowClass", $treescope_children)
if not isobj($oFF) Then
    _UIA_DumpThemAll($UIA_oDesktop,$treescope_children)
EndIf

;~ Make sure ff is front window
$oFF.setfocus()

consolewrite("Action 4 Click on New Tab" & @CRLF)
;~  $oFFNewTab= _UIA_getFirstObjectOfElement($oFFTabs,"controltype:=" & $UIA_ButtonControlTypeId, $treescope_subtree)
local     $oFFNewTab= _UIA_getObjectByFindAll($oFFTabs, $cFFNewTabByName,$treescope_subtree)
    if not isobj($oFFNewTab) Then
        _UIA_DumpThemAll($oFFTabs,$treescope_subtree)
    EndIf
 _UIA_action($oFFNewtab,"leftclick")
 sleep(500)

 

Edited by nooneclose
adding more information

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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