Sign in to follow this  
Followers 0
pedmacedo

How to click on a javascript link/button?

10 posts in this topic

#1 ·  Posted (edited)

Hello guys, I need to click on a javascript link, at least that's what I think it is. Here is the screenshot to help you guys understand

Posted Image

I tried geting it's X and Y position on the screen manualy but that does not work for all cases, because the position of the button changes depending on the page contend. The "button" I want to click is the "Veja telefone e fax" in the picture.

Thanks in advance! :x

EDIT for more info: What I click on this button a small window appears in the middle of the SAME page showing the info I need to access(I couldn't find this info on the HTML code)

Also, I can't select this button by tabbing

Edited by pedmacedo

Share this post


Link to post
Share on other sites



Any sugestion guys? :x

Share this post


Link to post
Share on other sites

Already tried with _IEFormGetCollection and _IEFormElementGetCollection combined togherer with an _IeAction click at the end?

And with Controlsend?

You might also want to try WinHttp.au3 after catching the POST or GET header that the button sends.

Nothing else comes up in my mind for now


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks for the sugestions Newb. I just found out that I can use _IENavigate($ie,"javascript:showTelPerfil(1);")

JohnOne looks like that's not what happened, I rapidly received 2 replies.

Anyway, sorry for doing that.

Edited by pedmacedo

Share this post


Link to post
Share on other sites

Thanks for the sugestions Newb. I just found out that I can use _IENavigate($ie,"javascript:showTelPerfil(1);")

JohnOne looks like that's not what happened, I rapidly received 2 replies.

Anyway, sorry for doing that.

You got lucky :x


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hey folks, I solved this problem but another one arised, when I use

_IENavigate($ie,"javascript:showTelPerfil(1);")

The script doesn't do anything else, it just sits idle(not paused). So then I thought using _IENavigate without waiting for the page to load

_IENavigate($ie,"javascript:showTelPerfil(1);",0)

And now the following error occurs:

Posted Image

Any idea about what could be causing the problem? Are we supposed to use _IENavigate with javascript code?

Again, thanks for any help!

Edit: If I manually navigate to any other site(while the script is running) it starts working again, till it reaches this line of code again (it's a loop)

Edited by pedmacedo

Share this post


Link to post
Share on other sites

There must be something else going on. Whether you tell it to wait or not, the URL will get processed in $o_object.navigate. When you tell it not to wait, it simply returns to your code without entering the wait loop for page completion... is there another _IENavigate after this that may be triggering the error?

Did you try _IELinkClickByText($oIE, "Veja telefone e fax") ???

Suggest you get DebugBar (see my sig) to examine the HTML... you need to understand that View Source shows you the HTML before any client processing, DebugBar will shouw you the final markup.

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

Did you try _IELinkClickByText($oIE, "Veja telefone e fax") ???

Dale

I didn't try to do that because on the help file they say it shouldn't work with "onclick" and javascript stuff, but it just worked :x

Thanks Dale!

Share this post


Link to post
Share on other sites

The remark you are referring to is trying to tell you that other elements, like DIV, can look like links and are not... _IELinkClickByText has no restriction with anything to do with Javascript.

Remarks

Not all elements that appear to be links actually are. It is common practice to attach onclick Javascript events to other DOM elements to simulate the behavior of links. To activate such elements, use "click" with _IEAction.


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