MrJones Posted January 24, 2014 Share Posted January 24, 2014 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 $oIE = _IECreate("http://msdn.microsoft.com/pt-br/dn308572.aspx") Local $oSubmit = _IEGetObjByName($oIE, "Downloads") MsgBox(0,"Get Object", @error) $oSubmits = _IEAction($oSubmit, "click") MsgBox(0,"Action", $oSubmits) Can anyone help me? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 24, 2014 Moderators Share Posted January 24, 2014 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MrJones Posted January 24, 2014 Author Share Posted January 24, 2014 Sorry about this. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 24, 2014 Moderators Share Posted January 24, 2014 MrJones,No problem. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
JohnOne Posted January 24, 2014 Share Posted January 24, 2014 Chances are that the link is in a frame. Start by looking at _IEFrame* examples. If the frame is cross domain the difficulty will increase. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jdelaney Posted January 24, 2014 Share Posted January 24, 2014 (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 January 24, 2014 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. Link to comment Share on other sites More sharing options...
MrJones Posted January 24, 2014 Author Share Posted January 24, 2014 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) Link to comment Share on other sites More sharing options...
jdelaney Posted January 24, 2014 Share Posted January 24, 2014 The "name" is the name attribute, or the ID attribute. It does not correate with the "label" attribute. That is the wrong function to use. 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. 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