Jump to content

Recommended Posts

Posted

Hello,

I use AutoIt for a while, but i never used IE.au3.

I'm trying to click on a <a> like this:

    <a href="http://msdn.microsoft.com/dn292944" title="Downloads">Downloads</a>

My code is getting error 7 (no mach) but I don't why.

 

#include <IE.au3>
 
 
; Start IE
Local $oSubmit = _IEGetObjByName($oIE, "Downloads")
 
MsgBox(0,"Get Object", @error)
 
$oSubmits = _IEAction($oSubmit, "click")
MsgBox(0,"Action", $oSubmits)

 

 

Can anyone help me?

  • Moderators
Posted

MrJones,

Welcome to the AutoIt forum. :)

But please pay attention to where you post - the "Examples" section where you started this thread is clearly marked: "This is NOT a general support forum!". I have moved the thread for you, but would ask you to be more careful in future. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • Moderators
Posted

MrJones,

No problem. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (edited)

I'd suggest using: _IELinkGetCollection

For some reason, I couldn't get it to return anything right now...which is odd.

Using my signature:

$oIE = _IEAttach("your browser")
$a = BGe_IEGetDOMObjByXPathWithAttributes($oIE, "//a[@href='http://msdn.microsoft.com/dn292944']")
If IsArray($a) Then
    _IEAction($a[0],"Focus")
    _IEAction($a[0],"Click")
EndIf

Ah, just saw the above post, if that's true, then you have to look for the link within the context of the frame.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Posted

I tried a simpler website now. www.stackoverflow.com

If I try to use _IEGetObjByName() I got error 7 too.

#include <IE.au3>
; Start IE
Local $oIE = _IECreate("www.stackoverflow.com")
Local $oSubmit = _IEGetObjByName($oIE, "log in")
MsgBox(0,"Alert1", @error)
$oSubmits = _IEAction($oSubmit, "click")
MsgBox(0,"Alert2", $oSubmits)
 
I tried the aproach BGe_IEGetDOMObjByXPathWithAttributes() too without any luck
 
; Start IE
Local $oIE = _IECreate("www.stackoverflow.com")
$oIE = _IEAttach("your browser")
$a = BGe_IEGetDOMObjByXPathWithAttributes($oIE, "//a[@href='/users/login?returnurl=%2f%3fp%3d10']")
If IsArray($a) Then
    _IEAction($a[0],"Focus")
    _IEAction($a[0],"Click")
Else
    MsgBox(0,"Alert","Error")
EndIf

 

But _IELinkClickByText() works. Why can't i use _IEGetObjByName() then _IEAction()?

 
#include <IE.au3>
Local $oIE = _IECreate("www.stackoverflow.com")
_IELinkClickByText($oIE, "log in")
 
MsgBox(0,"Alert2", @error)

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
×
×
  • Create New...