Jump to content

How to click "OK" on IE Popup?


Hodahel
 Share

Recommended Posts

Hey guys,

I'm trying to make a little script to make some changes on IE everything works will until this popup with OK and Cancel button.

I've already tried several codes like:

$wint = "Message from webpage"
$wintt = "Do you want to change current profile?"
while 1
if WinExists("$wint", "$wintt")  then Controlclick("$wint", "$wintt"), "Button1", "LEFT", 1)
sleep(500)
wend

 or

while 1
if WinExists("[CLASS:#32770]")  then Controlclick("[CLASS:#32770]", "Button1", "LEFT", 1)
sleep(500)
wend

or

If WinExists("Message from webpage") Then
    WinActivate("Message from webpage")
    Controlclick("[CLASS:#32770]", "OK", "Button1", "LEFT", 1, 44, 14)
EndIf

But still my script wont click the OK button..:(

 

When I tried to make all of the above script into EXE, then run it during the appearance of popup, the popup will close but when run inside the script with like runwait click_ok.exe, no effect..:(

 

Any idea to get me through it?

 

TIA

Link to comment
Share on other sites

Yes just a typo..here is the correct code I used..

$wint = "Message from webpage"
$wintt = "Do you want to change current profile?"
while 1 
if WinExists($wint, $wintt) then 
Controlclick($wint, $wintt, "Button1", "LEFT", 1) 
sleep(500) 
wend

Here is another code I already tried..

If WinExists("Message from webpage") Then
Controlclick("Message from webpage", "OK", "Button1", "LEFT", 1, 44, 14)
EndIf

Still I never make it to work..:(

Link to comment
Share on other sites

also you say the popup has 2 buttons with OK and Cancel, in your script you use the string "Button1" in place of a controlID, what is "Button1"?

Edited by PincoPanco

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

  • Moderators

As there have already been several questions seeking clarification, why not post your script in its entirety so we don't have to guess? Help us help you :)

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

most of the time, that only pops up when there is a formsubmit. almost like a "Confirm" button.

i would check to see if the section of code on the site you r working with has the button type as submit.

if it does, use the formsubmit function and that "OK" button shouldnt appear.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...