Sign in to follow this  
Followers 0
joe1981al

IEAction Click doesn't fire off javascript "mousedown"

8 posts in this topic

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.

Share this post


Link to post
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

1 person likes this

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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0