b0ris Posted May 29, 2008 Posted May 29, 2008 (edited) Could you spare some time to shed me some light on how to click a javascript "link"? I've already checked all the help file and most of the forum topics but haven't found a clear answer on this. For example, if I have a link which looks like this(I've got this by clicking 'Copy Shortcut'): LINK REMOVED or there's another example: LINK REMOVED How can I click this? Any idea? Edited June 17, 2008 by b0ris
ivan Posted May 29, 2008 Posted May 29, 2008 (edited) Could you spare some time to shed me some light on how to click a javascript "link"?I've already checked all the help file and most of the forum topics but haven't found a clear answer on this.For example, if I have a link which looks like this(I've got this by clicking 'Copy Shortcut'):java script:changeContent('/Hyperion/browse/browseList?dest=00000112b980fed9-0000-047a-0a0c00e7','/Hyperion/browse/browseNav?dest=00000112b980fed9-0000-047a-0a0c00e7');or there's another example:java script:windowOpenInsight("/Hyperion/dataaccess/Browse?REQUEST_TYPE=GET_DOCUMENT&DOC_UUID=0000010653f4bee8-0000-0d11-0a0c00e7&DOC_VERSION=1&JScript=enable","_newODS");How can I click this? Any idea?Click, out of ideas, navigate to link will accomplish the same task.You might want to get a collection of links available in the document with _IELinkGetCollection and use _IENavigate to the href of the link. This will only work for links that are made available to the document and not created dynamically, but it's worked for me in the past.Now, if you own the script you could use a procedure like the one in my sig to transfer js data to au3.ivan Edited May 29, 2008 by ivan Think out of the boxGrabber: Yet another WinInfo tool_CSVLib (still alpha)Dynamic html in au3
b0ris Posted May 29, 2008 Author Posted May 29, 2008 Click, out of ideas, navigate to link will accomplish the same task.You might want to get a collection of links available in the document with _IELinkGetCollection and use _IENavigate to the href of the link. This will only work for links that are made available to the document and not created dynamically, but it's worked for me in the past.Now, if you own the script you could use a procedure like the one in my sig to transfer js data to au3.ivanThank you for the quick reply. However, _IELinkGetCollection is telling me that there are 0 links so I'm afraid that's not the thing I should do....Any other ideas?
DaleHohm Posted May 29, 2008 Posted May 29, 2008 You can only click on elements that appear in the document. Those are javascripts that are most certainly bound to some other element on the page. You need to figure out how these scripts are called. DebugBar may help you. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
ivan Posted May 29, 2008 Posted May 29, 2008 (edited) Use fireEvent Method to trigger the changeContent event. FROM MSDN: fireEvent Method -------------------------------------------------------------------------------- Fires a specified event on the object. Syntax bFired = object.fireEvent(sEvent [, oEventObject]) Parameters sEvent Required. String that specifies the name of the event to fire. oEventObject Optional. Object that specifies the event object from which to obtain event object properties. Return Value Boolean. Returns one of the following values: true Event fired successfully. false Event was cancelled.Hope this works IVAN Edited May 29, 2008 by ivan Think out of the boxGrabber: Yet another WinInfo tool_CSVLib (still alpha)Dynamic html in au3
b0ris Posted May 30, 2008 Author Posted May 30, 2008 Use fireEvent Method to trigger the changeContent event. FROM MSDN: Hope this works IVAN Sorry, I'm not sure I've got the point of that...my code looks like this at the moment: #Include <IE.au3> $oIE = _IECreate ("https://localhost/browse") $passw = "********" _IELoadWait ($oIE) WinSetState("","",@SW_MAXIMIZE) MouseClick("left",383,383,1) send($passw) Mouseclick("left",379,679,1) _IELoadWait ($oIE) $sEvent="click" $bFired=$oIE.fireEvent($sEvent,$oIE) MsgBox(1,"link",$bFired) _IELoadWait ($oIE) MouseMove(143,374) MouseDown("left") MouseMove(222,374) MouseUp("left") _IELoadWait ($oIE) It seems like it's not working at the moment because of the fireEvent thing I just added. I haven't found the method in the help file, so no idea how to use it...
ivan Posted May 30, 2008 Posted May 30, 2008 (edited) I see you're using a local server to test your script. Have you got an internet page in mind so I can conduct a test? Specifically, I'm looking for an event in the tag that contains the link. For example, an image may have an onmousedown="functionName(parameters);" within the img tag. What you then have to do is to obtain an object reference to the tag and fire the onmousedown event to get the browser to navigate to the link. Edited May 30, 2008 by ivan Think out of the boxGrabber: Yet another WinInfo tool_CSVLib (still alpha)Dynamic html in au3
b0ris Posted May 30, 2008 Author Posted May 30, 2008 I see you're using a local server to test your script. Have you got an internet page in mind so I can conduct a test?Nope, I'm not using localhost, just I've changed the address in the script as I think it may be confidential...However, I can save a copy of one of the pages and send it over to you in e-mail if you could spare some time to check it...
ivan Posted May 30, 2008 Posted May 30, 2008 (edited) If you followed the update on my last post then your autoit could look something like $oRef.fireEvent("onmousedown") where $oRef is the reference to your image tag. If you want you may e-mail me at iap.perez@yahoo.com PS. The source code of Dale's _IE library contains a few fireEvent which may guide you through the process IVAN Edited May 30, 2008 by ivan Think out of the boxGrabber: Yet another WinInfo tool_CSVLib (still alpha)Dynamic html in au3
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