Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pressing "Ok" on a Confirm Popup

Status
Not open for further replies.

rodpettit

Technical User
Oct 28, 2003
5
AU
Hi,
I'm automating a webpage analyser. I can currently get the webpage to load & reload, analyse the various info & press the Submit button. However, the page requires a confirmation prior to sending the form. It calls the confirm() function which pops-up a small window with Ok or Cancel. I want to automate the clicking of 'Ok'. Any ideas?

Some simplified code segments below....

Thanks,
Rod

Code:
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Navigate "[URL unfurl="true"]http://www.mysite.com"[/URL] 
openBrowser = IE

 ' Search all the items in the webpage form 
 For i = 0 to IE.document.forms(0).length-1
  ' Is the item a Submit button? 
  If IE.document.forms(0).item(i).value = "Submit" Then 
  ' Focus on the submit button 
   IE.document.forms(0).item(i).focus
   ' Click the submit button 
     IE.document.forms(0).item(i).click
   ' Confirm box will come up here & I want to press 'Ok' 
    Something in here to press the popup Ok button ???
    End If
   Next 
  End If 		
 Next
 
Just a guess but maybe look into using the SendKeys function.This sends a strem of keystrokes, not sure how it works in the context of a IE window. Good Luck
 
Hi Ralph,
I've tried SendKeys, but without success. Perhaps it could work, but I need a specific example.
Once the confirm() popup function is called, the Wscript seems to pause & wait for the confirmation (Ok or Cancel) before continuing.
Thanks,
Rod
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top