Sign in to follow this  
Followers 0
karolisk

clicking IE element doesn't fire javascript 'mouseup' event

11 posts in this topic

Hi all,

my question is pretty simple:

how to fire mouseup event when clicking html element in IE.

Please let me know if anything is not clear or you need more info, thanks!

Karolis

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

ok, I found out myself:

$o.fireEvent("mouseup")

edit: but it throws error is there is no such javascript event. I still need to find out how to simulate normal mousedown and mouseup

Edited by karolisk

Share this post


Link to post
Share on other sites

onmouseup


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

#4 ·  Posted (edited)

onmouseup

Well, in test case it worked for me without 'on'. I tried '$o.fireEvent("onmouseup")' and nothing happens.

I was trying to get element coordinates (relative to screen) so that I could use standard 'mouseup' function. With no success.

P.S. In WINTASK there is a function 'ClickHTMLElement'. Here you can specify html tag and descriptor, like:

ClickHTMLElement("TD[OUTERTEXT= 'text']")

and it works. I wish there would be something like this in autoit. In autoit I always have to get a list and loop through all objects looking for a certain property. This works slowly and when I find the element I'm having problems when clicking it. Sorry for the criticism, but I hope it migh help to improve :).

Edited by karolisk

Share this post


Link to post
Share on other sites

good news - I found a solution:

$x = _IEPropertyGet($tr, "screenx")
$y = _IEPropertyGet($tr, "screeny")
$w = _IEPropertyGet($tr, "width")
$h = _IEPropertyGet($tr, "height")
MouseClick("left", $x + ($w/2), $y + ($h/2))

I found it while searching solution to other issue in this topic http://www.autoitscript.com/forum/index.php?showtopic=56602&st=20. That one is very similar to my current problem and isn't solved :/.

Share this post


Link to post
Share on other sites

ok, but this doesn't work when there is a big list and table cells are hidden (need to scroll to see). Life is hard...

Share this post


Link to post
Share on other sites

Click is different than mouse down.

See _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

Share this post


Link to post
Share on other sites

Click is different than mouse down.

See _IEAction($oElement, "click")

Dale

of course I tried this. This doesn't fire crappy javascripts of that page. Usually I do something like

_IENavigate($ie, "javascript:clickOnNode('2')", 0)

as workaround, but it's very tricky and hard to implement in some cases.

Share this post


Link to post
Share on other sites

Have you torn apart html and javascript on the page to see what events are actually being monitored? It can on lots of different events like onmouseover, onmousedown, onclick, onfocus, onfocusin etc. I know it can get really convoluted.

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

Share this post


Link to post
Share on other sites

yes, I did. In that case which I didn't solved yet, there are no inline javascript events and that table is dynamically generated, so I really couldn't even find where events are attached :). According to behavior it seems that onmousedown event is triggered (table row is 'selected' when I press mouse down). But when I try to fire it, on table cell, or row - nothing happens.

Like I said before, standard autoit 'MouseClick' works, but only if element is visible (and I couldn't find a workaround for this).

Share this post


Link to post
Share on other sites

Do you have any solution on this topic?

How to work with onmouseover and onmouseout fireEvents?

What about hiddens menus and tables and cells?

This is what I want to do

Click on the Actions table cell having a TD tag and innerText as Actions and title as Actions

I have used the method of tag collection using TD in TDs in a for loop.

Then if TD.title == "Actions" then TD.fireEvent("onclick")

but then I am not able to click on User Profile - table cell.

Name , My Subscriptions, Delegations and User Profile are having dynamic ids, so I cannot use the method GetObjById

------

Actions(Click here)----(this works fireEvent onclick works here properly)

Name - (I want to do a onmouseover event here then on next cell and at the end fireevent onclick on User Profile)

My Subscriptions

Delegations

User Profile (ie here - onclick - this is not working)

Please let me know if you or anyone can help.

Thanks

Rahul

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