Jump to content

IEAction Click doesn't fire off javascript "mousedown"


Recommended Posts

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

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

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

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

Dale:

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

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

Dale:

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

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

  • 2 years later...

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

  • 5 years later...

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

  • 10 months later...

 

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 

image.thumb.png.bd580e1bd18d4022864312cbfa2a49a3.png

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

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
 Share

  • Recently Browsing   0 members

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