joe1981al Posted July 21, 2010 Share Posted July 21, 2010 Anybody know a workaround to get a script to fire the "mousedown" event? I'm even up for using mouseclick if there is a way to detect screen location of the link. I've tried a few things but no success, the javascript on a page i'm trying to automate uses a mousedown event to pull data and load a frame using some system IE variables associated with the a href link clicked, then uses a onclick to cancel the navigation to the a href. I've tried to throw together some navigate(javascript:action) stuff but doesn't work because the variables are not in memory that it needs to fire off the event. Link to comment Share on other sites More sharing options...
Bert Posted July 22, 2010 Share Posted July 22, 2010 can you read the HTML first to get the location? Also, is the page you are working with, is it publicly accessible so we can take a look at the code? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
DaleHohm Posted July 22, 2010 Share Posted July 22, 2010 It turns out that the actual event sequesnce of a mouse click is onmousedown, onmouseup, click. I was unaware of this when I wrote the _IEAction function. You can create the full sequence with: $oElement.fireEvent("onmousedown") $oElement.fireEvent("onmouseup") _IEAction($oElement, "click") Dale phamdacloc 1 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 Link to comment Share on other sites More sharing options...
joe1981al Posted July 22, 2010 Author Share Posted July 22, 2010 It turns out that the actual event sequesnce of a mouse click is onmousedown, onmouseup, click. I was unaware of this when I wrote the _IEAction function. You can create the full sequence with:$oElement.fireEvent("onmousedown")$oElement.fireEvent("onmouseup")_IEAction($oElement, "click")DaleDale:Thanks Dale will give this a try. I've spent 3 days dealing with this site trying to automate a single file download, and got stuck because of the way someone wrote the site. Wouldn't be a bad idea to add a "fullclick" process to _IEAction that does the above.Volly:It requires login, but the details I see: They use a very large main javascript thats been minified, that stores a lot of functions while it loads a small file that monitors the individual page and waits for actions. I'm not sure how IE works, but I assume on "mousedown" IE creates variables for navigating to a link then acts upon those variables when it sees "click". The sites javascript fires an action on "mousedown" that loads ALOT of variables in two collections, one containing system variables, one dumping ie variables, in particular uses "t.id" to figure out the URL of the <a href> tag and execute code based upon its content to load a secondary frame with a javascript panel. Then fires on "click" and cancels IEs native link handling. Link to comment Share on other sites More sharing options...
joe1981al Posted July 22, 2010 Author Share Posted July 22, 2010 It turns out that the actual event sequesnce of a mouse click is onmousedown, onmouseup, click. I was unaware of this when I wrote the _IEAction function. You can create the full sequence with:$oElement.fireEvent("onmousedown")$oElement.fireEvent("onmouseup")_IEAction($oElement, "click")DaleDale:Thanks Dale will give this a try. I've spent 3 days dealing with this site trying to automate a single file download, and got stuck because of the way someone wrote the site. Wouldn't be a bad idea to add a "fullclick" process to _IEAction that does the above.Volly:It requires login, but the details I see: They use a very large main javascript thats been minified, that stores a lot of functions while it loads a small file that monitors the individual page and waits for actions. I'm not sure how IE works, but I assume on "mousedown" IE creates variables for navigating to a link then acts upon those variables when it sees "click". The sites javascript fires an action on "mousedown" that loads ALOT of variables in two collections, one containing system variables, one dumping ie variables, in particular uses "t.id" to figure out the URL of the <a href> tag and execute code based upon its content to load a secondary frame with a javascript panel. Then fires on "click" and cancels IEs native link handling. Link to comment Share on other sites More sharing options...
joe1981al Posted July 22, 2010 Author Share Posted July 22, 2010 It works and interacts perfectly with the javascript, and also had to look up your IEEVal() function from another thread that works great. Something to maybe add to the IEAction is "fullclick" or even replace click with all three actions, I add function to my script to do fullclick action every time just in case some javascript is watching it. Func _IEMyFullClick($oElement) ;Function to perform full click $oElement.fireEvent("onmousedown") $oElement.fireEvent("onmouseup") _IEAction($oElement, "click") EndFunc Link to comment Share on other sites More sharing options...
phamdacloc Posted April 25, 2013 Share Posted April 25, 2013 Hi Dale-Just to re-confirm, does the "onmouseup" event occur BEFORE the click action or AFTER the click action like the below?$oElement.fireEvent("onmousedown")_IEAction($oElement, "click")$oElement.fireEvent("onmouseup")Thanks Link to comment Share on other sites More sharing options...
DaleHohm Posted April 29, 2013 Share Posted April 29, 2013 The order is as I documented above. 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 Link to comment Share on other sites More sharing options...
tac7 Posted November 7, 2018 Share Posted November 7, 2018 Hi All, I've just sign in only to remerciate you about this code 8 years later !!!! I had the same problem with a link where the "onclick" is desactevated (onclick="return false;") :-( and whith your code is perfectly.. Tanks a lot On 22/07/2010 at 5:21 PM, joe1981al said: It works and interacts perfectly with the javascript, and also had to look up your IEEVal() function from another thread that works great. Something to maybe add to the IEAction is "fullclick" or even replace click with all three actions, I add function to my script to do fullclick action every time just in case some javascript is watching it. Func _IEMyFullClick($oElement) ;Function to perform full click $oElement.fireEvent("onmousedown") $oElement.fireEvent("onmouseup") _IEAction($oElement, "click") EndFunc Link to comment Share on other sites More sharing options...
JEGAN Posted September 23, 2019 Share Posted September 23, 2019 Hi all i too have a mouse down case as shown below, Help out to perform click operation on highlighted object in html tree #include <IE.au3> #include <Array.au3> Local $oIE = _IECreate("http://pass-ssi-a350.eu.airbus.corp:8020/D850/app/", 1) _IELoadWait($oIE) Local $oSearch, $oSubmit Local $sSearch = InputBox("DS no to search","enter DS no","") $oSearch= _IEGetObjByName($oIE,"gloabalSearchField") $oSubmit=_IEGetObjById($oIE,"ext-gen29") $oSearch.value = $sSearch _IEAction($oSubmit, "click") _IELoadWait($oIE) Sleep(3000) _IELinkClickByText($oIE,$sSearch) Sleep(3000) $odiv=_IEGetObjById($oIE,"infoPagemainInfoPagePanel") $oform=_IEFormGetObjByName($odiv,"mainform") $odiv1=_IEGetObjById($oform,"infoPageinfoPanelID") $odiv2=_IEGetObjById($odiv1,"infoPageinfoPanelID__infoPage_myTab_object_partContentTab") $odiv2.fireEvent("onmousedown") _IEAction($odiv2, "click") html tree in website is Java click even code is task;fn=fn||o.fn;scope=scope||o.scope;if(!el)throw'Error listening for "'+ename+'". Element "'+element+"\" doesn't exist.";function h(e){if(!Ext)return;e=Ext.EventObject.setEvent(e);var t;if(o.delegate){if(!(t=e.getTarget(o.delegate,el)))return}else t=e.target;if(o.stopEvent)e.stopEvent();if(o.preventDefault)e.preventDefault();if(o.stopPropagation)e.stopPropagation();if(o.normalized)e=e.browserEvent;fn.call(scope||el,e,t,o)}if(o.target)h=createTargeted(h,o);if(o.delay)h=createDelayed(h,o,fn);if(o.single)h= 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