Help with Appelscript driven safari

Hi All,

I am new to applescripting so any help is appreciated.

Having an issue with an applescript that drives safari. I have a script that logs in and navigates a site then I need to click on a link that will launch and pop up window containing a form. Then I need to hit submit. The popup will launch but the only way I can get it to is to do

tell application "Safari" to do JavaScript "javascript:openMdlWindow('InvestmentDetailOptions.aspx?IDAssetType=','620','600');if(window.document.RetValue == '2'){window.parent.LoadinIframe('InvestmentDetail.aspx?FromMenu=N&IDAssetType=','Investment Details > Full View','false');}" in document 1

Problem is it then hangs and will not continue on with applescript rather it times out.

Next lines would be

do JavaScript “document.aspnetForm.ctl00$ContentPlaceHolder2$selectDay.value = "” & theWord & “"” in document 1

do JavaScript “document.all("ctl00$ContentPlaceHolder2$btnSubmit2").click()” in document 1

Is there a way to get the link popup to fire and move on to next events?

The link on the page looks like this maybe I am not getting it correctly:
Filter

Thanks in advance for any help.

Try this:

ignoring application responses
	tell application "Safari" to do JavaScript "javascript:openMdlWindow('InvestmentDetailOptions.aspx?IDAssetType=','620','600');if(window.document.RetValue == '2'){window.parent.LoadinIframe('InvestmentDetail.aspx?FromMenu=N&IDAssetType=','Investment Details > Full View','false');}" in document 1
end ignoring