Jump to content
Sign in to follow this  

Opening a JavaScript Link

Recommended Posts



I have an application on which there is a link which the user can click if they have forgotten their password. I want to extract the href from this URL, go to it, and take a screenshot.

My problem is that the link looks like this when I extract the href:

java script:openWindow('/root/forgotPassword.asp?affid=105-257&langid=1&close=true&RW=1','forgotPassword',450,270);

so I can't use _IELoadWait() to open it. I could just click on the control and use sleep(), but I want to avoid this if at all possible.

Does anyone have any suggesstions? My function is below:

Func _TestForgotPasswordLink()
; Click the 'Forgot our Password?' link
$oInputs = _IETagNameGetCollection ($o_IE_Main, "a")
$link = ""
; Search for the link we are looking for by it's id
For $oInput In $oInputs
    If($oInput.id == $FORGOT_PASSWORD_LINK) Then
        $link = $oInput.href
_FileWriteLog($tempLog, "Link to 'Forgot Your Password?: " & $link)
; How to open Javascript link here?

; Want to avoid do this..


Share this post

Link to post
Share on other sites

You'll need to look at the openWindow script to see what it does and reverse engineer the outcome if you don't want to click the link. You see that it is not just a URL, but also parameters taht are processed by the script.


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