Sign in to follow this  
Followers 0
candyania

How to click Yes button in Alert Warning Window

21 posts in this topic

I tried to use controlclick to click "Yes" button in an Alert Warning window, code is like:

WinWait("Security Warning");

WinActivate("Security Warning");

ControlClick("Security Warning", "","Yes");

what's weird is it cannot work for Yes button, but work well for No button...if change code as:

WinWait("Security Warning");

WinActivate("Security Warning");

ControlClick("Security Warning", "","No");

and I also tried ControlClick("Security Warning", "","[CLASS:Button; INSTANCE:1]");//Yes button is the first button in the alert window

but still cannot work successfully to click Yes button.

Do anyone know the reason why??

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

What are the contents of the window info tool?

i don't know whether you mean ie develop tool bar as you mentioned window info tool, but it cannot work when there is popup alert window, when i tried to use the tool, always ask me to click alert window first

Edited by candyania

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

To display a picture you first need to upload it to an image host.

For example http://photobucket.com/

there are many more, can you not just paste the text of the summary?

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

To display a picture you first need to upload it to an image host.

For example http://photobucket.com/

there are many more, can you not just paste the text of the summary?

Check the screenshot here:

Posted Image

Edited by candyania

Share this post


Link to post
Share on other sites

This looks like IE security window.

You can configure IE to not display such warnings.

Put the original site in the trusted zone - this may solve your issue.

Share this post


Link to post
Share on other sites

I have checked the button with window info tool, and the Yes button is instance:2, so i modified code as:

ControlClick("Security Warning", "","[CLASS:Button; INSTANCE:2]");

However, i can see the focus moved to Yes button, but seems there is no Click action...don't understand why

Info grabbed by tool show as:

Class Button

Instance 2

ClassnameNN Button2

Advanced Mode [CLASS:Button; INSTANCE:2]

ID 1

Text Yes

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I have checked the button with window info tool, and the Yes button is instance:2, so i modified code as:

ControlClick("Security Warning", "","[CLASS:Button; INSTANCE:2]");

However, i can see the focus moved to Yes button, but seems there is no Click action...don't understand why

Info grabbed by tool show as:

Class Button

Instance 2

ClassnameNN Button2

Advanced Mode [CLASS:Button; INSTANCE:2]

ID 1

Text Yes

More info of this button:

Advanced Mode [CLASS:Button; INSTANCE:2]

ID 1

Text Yes

Position 215,96

I tried to locate the Yes button by adding x, y like:

ControlClick("Security Warning", "","[CLASS:Button; INSTANCE:2]",,215,96);

but seems the format is not correct, function reference for controlclick is like:

ControlClick("title","text",controlID [, button [, clicks [, x[, y]]]])

do anyone know how to resolve this?

Edited by candyania

Share this post


Link to post
Share on other sites

This looks like IE security window.

You can configure IE to not display such warnings.

Put the original site in the trusted zone - this may solve your issue.

I do add the site into my trust list, but still the warning msg will popup.

Share this post


Link to post
Share on other sites

On the security window there are 2 sites. THe second one is in your trust list but are you sure the first one is there?

Share this post


Link to post
Share on other sites

I have a similar issue.

Here is my code:

ShellExecuteWait("folder\file.reg")
    WinWait("[Class:#32770]")
    WinActivate("[Class:#32770]")
    ControlClick("[Class:#32770]", "","[CLASS:Button; INSTANCE:1]");

I also tried with the name of the window - "Registry editor" instead of the class, but still nothing happens.

What I'm trying to do:

-Use ShellExecuteWait in order to run a reg file - this works fine

-When the Registry Editor confirmation window appears "Are you sure you want to add the information .... into the registry" I want to click on the Yes Button, but using the above code has no results.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Usually with the security warnings I've found that the program that launched it cannot click the buttons - So I just create a simple While...WEnd loop in another script compile it and call it before that security warning appears. Its not the best solution but it works.

Edit:

And for John H - Change ShellExecuteWait to just ShellExecute - The msgbox is still considered part of the program you told it to run so AutoIT won't continue until the MsgBoxs are gone.

Edited by LurchMan

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Share this post


Link to post
Share on other sites

Hey LurchMan,

Thanks for the tip.

It's working fine now.

Share this post


Link to post
Share on other sites

Hey LurchMan,

Thanks for the tip.

It's working fine now.

For future reference as well, Don't piggy back on a topic with your issue - they weren't quite the same. Just create a new post next time.


Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Share this post


Link to post
Share on other sites

Yup, you're right. I'll do that.

candyania's issue was related to a Alert Warning Window, mine window was a simple one.

Thanks,

John

Share this post


Link to post
Share on other sites

Hi John,

I am very new to Autoit. I was having a problem(see the attachment) while handling the java security warning popup window but it is fixed now using the below code.

 
JavaSecurityWarning.png?part=4&view=1&vt
I am able to click on Allow button using the below code. 
ShellExecuteWait("folder\file.reg")
    WinWait("[Class:#32770]")
    WinActivate("[Class:#32770]")
    ControlClick("[Class:#32770]", "","[CLASS:Button; INSTANCE:1]"); 

 But my question is : I want to verify whether that warning popup window is coming or not in the page using "if" condition. If it will come then only i will click on Allow otherwise no need to click on simply ignore. Can anyone please suggest me How to accomplish this?

With Best Regards,

Sudhansu.

 
 
 

Share this post


Link to post
Share on other sites

Welcome to AutoIt and the forum!

This thread is more than 3 years old and the user hasn't been active for 2 1/2 years.

So I suggest not to necro such an old thread but to open a new one ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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  
Followers 0