Jump to content
Sign in to follow this  

Click IE links for Pop Up window and get data from it

Recommended Posts


Hi Team,

Please help me to solve this problem. I have to retrieve information from pop up windows (eg: http://www.entheosweb.com/website_templates/business1/preview.htm) opened by clicking links (eg: click me) of home IE, http://www.entheosweb.com/website_design/pop_up_windows.asp. The pop windows has to be closed once information is retrieved and go to the next link of home IE.

The constrain here is, I cannot match link (“click me”) but the text before it (“allows you to open a browser window in any size you specify”) to select the link from the set of links.



Note : attached source code and expected output file for your reference

source code :


#include <IE.au3>

$oIE = _IECreate ("http://www.entheosweb.com/website_design/pop_up_windows.asp",0, 0) ;;open in invisible mode

$sText = _IEBodyReadHTML($oIE) ;;



If $sText Then

$subString = StringRegExp($sText, "(?i)(?s)allows you to open a browser window in any size you specify.(.+?)\s*Click here", 1)

If NOT @Error Then


$fileWrite = FileOpen("Output.txt", 1)

; Check if file opened for reading OK

If $fileWrite = -1 Then

MsgBox(0, "Error", "Unable to open file Output.txt.")





$oLinks = _IELinkGetCollection($sText)

For $oLink in $oLinks

$sLinkText = _IEPropertyGet($oLink, "innerText")


;;click on the the link in the same line of "allows you to open a browser window in any size you specify"

_IEAction($oLink, "click") ;;here the link text may not be always "Click me"

$sTextPopUpIE = _IEBodyReadText($oIE)



_IEQuit ($oLink) ;;close the pop up IE window




If @Error Then

ConsoleWrite("Message:Cannot find Pattern")



Share this post

Link to post
Share on other sites

What does the DOM path look like? That kind of thing is often organized by a table, with text and links on a line sharing the same row (inside TR tags), and each element in it's own data cell (TD tags). In that case you identify the particular TD element with the text, and get $oTD.nextSibling, or get all links within the same TR or TD element, etc. Depends on the page layout and exactly what the relationship is between the text and the link.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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