Jump to content

Cannot click the "Yes" button of IE Dialog box


Recommended Posts

I want to click the "Yes" button of IE Dialog box with below script but fail. Please help

#include "dbug.au3"

#include <IE.au3>

Global $oIE, $oPopup

$oPopup = _IEAttach ("[CLASS:Internet Explorer_Server; INSTANCE:1]", "dialogbox")

_IEAction ( $oPopup, "click" )

_IELoadWait ($oPopup)

>>>> Window <<<<

Title: Information -- Web Page Dialog

Class: Internet Explorer_TridentDlgFrame

Position: 29, 164

Size: 850, 190

Style: 0x96C80000

ExStyle: 0x00000101

Handle: 0x001A0D90

>>>> Control <<<<

Class: Internet Explorer_Server

Instance: 1

ClassnameNN: Internet Explorer_Server1

Name:

Advanced (Class): [CLASS:Internet Explorer_Server; INSTANCE:1]

ID:

Text:

Position: 0, 0

Size: 844, 165

ControlClick Coords: 381, 27

Style: 0x56000000

ExStyle: 0x00000000

Handle: 0x002B0E22

>>>> Mouse <<<<

Position: 384, 49

Cursor ID: 0

Color: 0x404040

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

Link to comment
Share on other sites

Make sure you run your script with F5 in SciTe and pay attention to the messages sent to the SciTe console! They are not noise, but would rather point out you botched what you passed to _IEAttach.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Dear Dale,

Thank for your reply!

I amend the script and it display 0. Below is the html code

<HTML><HEAD><TITLE>Information</TITLE>

<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"><LINK href="stylesheets/styledarkblue.css" type=text/css rel=stylesheet>

<script src="jscript/ManagedDialog.js" type=text/javascript></SCRIPT>

<META content="Copyright © 1985, 2006 BY CGI-AMS INCORPORATED, ALL RIGHTS RESERVED. THIS PROGRAM IS PROPRIETARY AND IS THE PROPERTY OF: AMERICAN MANAGEMENT SYSTEMS, INCORPORATED COPYING OR USE OF THIS PROGRAM, EXCEPT AS SPECIFICALLY PROVIDED FOR IN A LICENSE AGREEMENT CONTROLLING SUCH USE, IS PROHIBITED. THIS PROGRAM IS DESIGNATED AS CONFIDENTIAL AND IS A TRADE SECRET UNDER APPLICABLE LAWS. UNAUTHORIZED COPYING OR DISCLOSURE IS PROHIBITED AND IS SUBJECT TO CRIMINAL AND CIVIL PENALTIES, INCLUDING FINES AND IMPRISONMENT." name=Copyright>

<script language=javascript>

function keyPress() {

}

</SCRIPT>

</HEAD>

<BODY onkeyup=keyPress(); text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<FORM>

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>

<TBODY>

<TR>

<TD noWrap width=8 height=6><IMG height=6 src="images/Corner_Left_top.gif" width=8></TD>

<TD background=images/0_TopRuleTop.gif height=6><IMG height=6 src="images/0_TopRuleTop.gif" width=1></TD>

<TD noWrap width=8 height=6><IMG height=6 src="images/Corner_Right_top.gif" width=8></TD></TR></TBODY></TABLE>

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>

<TBODY>

<TR>

<TD noWrap width=8 background=images/0_GreyRuleLeftSide.gif>&nbsp;</TD>

<TD class=TabOffBackground width="100%">

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>

<TBODY>

<TR>

<TD vAlign=top noWrap align=middle>&nbsp;</TD>

<TD noWrap width=6>&nbsp;</TD>

<TD>

<P class=ControlLabel>Information</P></TD>

<TD width="100%">&nbsp;</TD></TR>

<TR>

<TD vAlign=top noWrap align=middle>

<P class=ControlLabel>&nbsp;</P></TD>

<TD noWrap width=6>&nbsp;</TD>

<TD width="100%"><!-- Format Dialog message --><TEXTAREA class=InputFields style="OVERFLOW: auto; TEXT-ALIGN: center" name=DW_MessagesText rows=3 readOnly cols=90>Are you sure you want to delete this?</TEXTAREA> </TD>

<TD width="100%">&nbsp;</TD></TR>

<TR>

<TD vAlign=top noWrap align=middle>&nbsp;</TD>

<TD noWrap width=6>&nbsp;</TD>

<TD align=right><INPUT class=Button onclick="window.returnValue='yes'; window.close()" type=button value=Yes name=DW_MessagesYesButton> <INPUT class=Button onclick="window.returnValue='no'; window.close()" type=button value=No name=DW_MessagesNoButton> </TD>

<TD width="100%">&nbsp;</TD></TR></TBODY></TABLE></TD>

<TD noWrap width=8 background=images/0_GreyRuleRightSide.gif>&nbsp;</TD></TR></TBODY></TABLE>

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>

<TBODY>

<TR>

<TD height=6><IMG height=6 src="images/Corner_Left.gif" width=8></TD>

<TD width="100%" background=images/0_TopRuleBottom.gif height=6><IMG height=6 src="images/0_TopRuleBottom.gif" width=1></TD>

<TD height=6><IMG height=6 src="images/Corner_Right.gif" width=8></TD></TR></TBODY></TABLE></FORM></BODY></HTML>

Link to comment
Share on other sites

Dear Dale,

I still cannot click the "Yes" button. I also try below and still fail. Please see attached screen print and html source code of the dialog box.

#include <IE.au3>

Global $oIE, $oPopup

$oPopup = _IEAttach ("[CLASS:Internet Explorer_Server; INSTANCE:1]", "dialogbox")

ControlClick("Information--Web Page dialog", "", "[CLASS:Button; TEXT:Yes; Instance:1;]")

msgbox(0,"",isobj($oPopup))

post-55910-0-94434000-1294802446_thumb.j

HTML Source.zip

Link to comment
Share on other sites

Please show the output sent to the SciTe console.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Dear Dale,

It shows it cannot attached to IE. Please advise the correct method

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\w5\Auto\t3.au3"

--> IE.au3 V2.4-0 Warning from function _IEAttach, $_IEStatus_NoMatch

--> IE.au3 V2.4-0 Error from function _IEAction, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IELoadWait, $_IEStatus_InvalidDataType

>Exit code: 0 Time: 2.737

Link to comment
Share on other sites

How about:

$oPopup = _IEAttach ("Information", "dialogbox")

$oInput = _IEGetObjByName($oPopup, "DW_MessagesYesButton")

_IEAction($oInput, "click")

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • 3 years later...

Hate to necro post but this is probably the closest to my issue

I am trying to automate Juniper Network Connect, it runs a webpage within its software.

Im trying to wait for the page to fully load, once its loaded i want to put the username and password in and then click "Sign In" button. I've gotten to this point by using normal
ControlCommand's and such with Sleep(xxx) to wait, but its no ideal as some sites will load the page faster and soem slower so its not going to work on all my sites.

Im hoping that Dale's IE functions could help me.


Here is the webpage that runs in Juniper Network Connect software:
 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="robots" content="none">
<title>SSL VPN</title>

<script src="/dana-na/css/ds.js"></script>
<script>
        WriteCSS();
</script>
<noscript>
<link rel="stylesheet" href="/dana-na/css/ds.css">
</noscript>

<script>
<!--
if (window.top != self) {
    top.location = location;
}
if(window.name == "newpincancel" || window.name == "nexttokencancel") {
   window.close();
}
//--></script>
<script src="/dana-na/auth/lastauthserverused.js"></script>

</head>

<body onload="FinishLoad(1)" bgcolor="#FFFFFF" color="#000000" link="#3366CC" vlink="#CC6699" alink="#3366CC" leftmargin="0" topmargin="0" rightmargin="0" marginwidth="0" marginheight="0">

<table border="0" width="100%" cellspacing="0" cellpadding="3">
        <tr>
                <td  src="welcome.cgi?p=signinId=url_default" </td>
        </tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
        <tr>
                <td bgcolor="#000000" colspan="2"><img border="0" src="/dana-na/imgs/space.gif" width="1" height="1"></td>
        </tr>
</table>
<blockquote><form name="frmLogin" action="login.cgi" method="POST" autocomplete="off" onsubmit="return Login(1)">
        <input type="hidden" name="tz_offset">
        <table border="0" cellpadding="2" cellspacing="0">
                                        <tr>
                                                <td nowrap  colspan="3"><b>Welcome to the</b></td>
                                        </tr>
                                        <tr>
                                                <td nowrap  colspan="3"><span class="cssLarge"><b>SSL VPN</b></span></td></tr>
                                      
                                        <tr>
                                              <td colspan="3">&nbsp;</td>
                                        </tr>
                <tr>
                
                                <td valign="top">
                                
                                        <table border="0" cellspacing="0" cellpadding="2">                                                  <tr>
                                                        <td>Username</td>
                                                        <td>&nbsp;</td>
                                                        <td><input id="username_3" type="text" name="username" size="20" style="border: 1px inset #CCC;"/></td>
                                                    </tr>                                                   <tr>
                                                        <td>Password</td>
                                                        <td>&nbsp;</td>
                                                        <td><input id="password_3" type="password" name="password" size="20" style="border: 1px inset #CCC;"/></td>
                                                    </tr>                                                <tr>                                                                <input type="hidden" name="realm" value="Users">                                                </tr>                                                <tr>
                                                        <td colspan="3">&nbsp;</td>
                                                </tr>
                                                <tr>
                                                        <td>&nbsp;</td>
                                                        <td>&nbsp;</td>
                                                        <td><input type="submit" value="Sign In" name="btnSubmit">&nbsp;</td>
                                                </tr>                                        </table>
                              
                        </td>
                        <td valign="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td valign="top"><table border="0" cellspacing="0" cellpadding="2">
<tr><td>Please sign in to begin your secure session.<br><br><noscript>Note: Javascript is disabled on your browser.</noscript></tr></td></table></td>
    </tr>
        </table>  </form>
</blockquote>

</body>
</html>

I've tried
 

$oPopup = _IEAttach ("SSL VPN", "embedded")
$oInput = _IEGetObjByName($oPopup, "btnSubmit")
_IEAction($oInput, "click")

But it gives me the following error
 

--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-1 Warning from function _IEAttach, $_IESTATUS_NoMatch
--> IE.au3 T3.0-1 Error from function _IEGetObjByName, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-1 Error from function _IEAction(click), $_IESTATUS_InvalidDataType

Any idea's how i could get this to work?

Edited by t1ck3ts
Link to comment
Share on other sites

  • Moderators

t1ck3ts,

 

Hate to necro post but this is probably the closest to my issue

Then please do not do so again. Just open a new thread and link to the old one. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...