Jump to content

Clicking on OK in a IE prompt opened in a GUI


Neo
 Share

Recommended Posts

OK, that is really what we've been trying to figure out. This takes IE and the DOM out of the picture and it is just an Win32 issue.

Something like this (taken from the second example of _IEAction I pointed you to originally) should work:

WinWait("Microsoft Internet Explorer", "The form has not been changed.")
ControlClick("Microsoft Internet Explorer", "The form has not been changed.", "[CLASS:Button; TEXT:OK; Instance:1;]")
_IELoadWait ($oIE)oÝ÷ Ûú®¢×«Þ{¶©ºÛaÆ®¶­s`Ö÷W6T6Æ6²gV÷C¶ÆVgBgV÷C²ÃcÃSS2Ãõ5T$Ô@ våvBgV÷C´Ö7&÷6ögBçFW&æWBWÆ÷&W"gV÷C²ÂgV÷CµFRf÷&Ò2æ÷B&VVâ6ævVBâgV÷C² 6öçG&öÄ6Æ6²gV÷C´Ö7&÷6ögBçFW&æWBWÆ÷&W"gV÷C²ÂgV÷CµFRf÷&Ò2æ÷B&VVâ6ævVBâgV÷C²ÂgV÷Cµ´4Ä53¤'WGFöã²DUC¤ô³²ç7Fæ6S£µÒgV÷C² ôTÆöEvBb33c¶ôR Ö÷W6T6Æ6²gV÷C¶ÆVgBgV÷C²Ãs3ÃSS2Ãõ$UEU$à

But it still doesn't seem to work :S

Link to comment
Share on other sites

OK, that is really what we've been trying to figure out. This takes IE and the DOM out of the picture and it is just an Win32 issue.

Something like this (taken from the second example of _IEAction I pointed you to originally) should work:

WinWait("Microsoft Internet Explorer", "The form has not been changed.")
ControlClick("Microsoft Internet Explorer", "The form has not been changed.", "[CLASS:Button; TEXT:OK; Instance:1;]")
_IELoadWait ($oIE)oÝ÷ ض¬¶X§yì^^wMwßM¢ë
X«¨¶W¶«¨·¯4çõñ%0ÁºØ­²Ø¥Ú²}ý¶ÇÚ0¢¹"¯y©l¢fzË«zØZ¶Ø^Â)Ý£^Æج¶nÞ¢w²'ðyÈZ­êk¢«¶'¬¡ö®±êíéðéì¹¹¢¶×Ü"X"½ëazg¬±¨ªê-RÇ«wè®f­Ô¥Ö­yÚ®¢Ò'z+az·±è­v¬mÂä"¯y©l¢ÚâyÛaÆ®¶­s` ¥våvBgV÷C´Ö7&÷6ögBçFW&æWBWÆ÷&W"gV÷C²¥vä7FfFRgV÷C´Ö7&÷6ögBçFW&æWBWÆ÷&W"gV÷C²¤6öçG&öÄ6Æ6²gV÷C´Ö7&÷6ögBçFW&æWBWÆ÷&W"gV÷C²ÂgV÷C²gV÷C²ÂgV÷Cµ´4Ä53¤'WGFöã²DUC¤ô³²ç7Fæ6S£µÒgV÷C²¥ôTÆöEvBb33c¶ôRoÝ÷ ض¬¶X§yì^rë^wMwßM¢ë
X«¨¶W¶«¨·¯4çõñ%0í+ºÚ"µÍÚ[ØZ]
    ][ÝÓZXÜÜÛÙ[]^Ü][ÝÊBYÝÚ[]J ][ÝÓZXÜÜÛÙ[]^Ü][ÝÊH[Ú[]]][ÝÓZXÜÜÛÙ[]^Ü][ÝÊBÚ[ØZ]]J    ][ÝÓZXÜÜÛÙ[]^Ü][ÝÊBÛÛÛÛXÚÊ   ][ÝÓZXÜÜÛÙ[]^Ü][ÝË ][ÝÉ][ÝË    ][ÝÖÐÓTÔÎ]ÛÈVÒÎÈ[Ý[ÙNN×I][ÝÊBÒQSØYØZ]
    ÌÍÛÒQJ

Last line executed: 0133: 0-0: MouseClick("left",680,553,1,8) ;SUBMIT

But none of these worked. What I don't understand is why is it working when this was running in IE directly. When I click the OK button myself it gets to this line:

0134: 0-0: WinWait("Microsoft Internet Explorer", "The form has not been changed.") and hangs.

I was hoping to get it to work easily in GUI to adapt it to any resolution because of the Mouseclicks depending on the coordinates and the fact that I didn't know how to select a specific button, a specific text or a specific item in a listbox. But if you can help me I also have the Internet Explorer based code that I prefer to convert into a smarter no-coordinate based script. I really appreciate you helping me. Thank you again and again.

Link to comment
Share on other sites

This is so next to impossible without being able to access the webpage you are working on.

The information is just not making sense. The only way much of what you have told me makes any sense is that somehow the line of code that causes your script to stall doesn't get echoed to the colsole until it completes -- but I don't think it works that way. When I use the debug mode, the line that causes the script to stall (say a Sleep command) gets displayed to the colsole immediately.

A couple of replies ago, you put in a ConsoleWrite after the submit MouseClick and got executed and you saw its output. But then you seemed to say that the last debug line you saw to the colsone was the WinWait command -- even though you put in a 4 second timeout. You should have seen the next line echoed.

Now you are back to the submit MouseClick being the last line echoed to the console.

You need to figure out how your situation differs from the following stand-alone example. Why is it this works when yours does not? In addition to the debug mode, please try making liberal use of ConsoleWrite to show you where you are in your code, your status and perhaps variable current values.

Another thought, in you are playing with WinTitleMatchMode, make sure you knwo what you are doing and what state it is in when you get into trouble.

Hopefully you have enough debugging tools to help you progress now. Without seeing your code and your webpage my hands are really tied.

Here is the sample code to compare your situation to:

#AutoIt3Wrapper_run_debug_mode=Y
#include <IE.au3>

; Create a test browser window with a form and submit button
$s_html = ""
$s_html &= "<HTML>" & @CR
$s_html &= "<HEAD>" & @CR
$s_html &= "<BODY>" & @CR
$s_html &= "<form name='ExampleForm' onsubmit='java script:alert(""ExampleFormSubmitted"");' method='post'>" & @CR
$s_html &= "<input name='submitExample' type='submit' value='Submit'>" & @CR
$s_html &= "<input name='resetExample' type='reset' value='Reset'>" & @CR
$s_html &= "</FORM>" & @CR
$s_html &= "</BODY>" & @CR
$s_html &= "</HTML>"
$oIE = _IECreate()
_IEDocWriteHTML($oIE, $s_html)

; Find coordinates of the submit button and click on it
$oSubmit = _IEGetObjByName ($oIE, "submitExample")
$x = _IEPropertyGet($oSubmit, "screenx")
$y = _IEPropertyGet($oSubmit, "screeny")
$w = _IEPropertyGet($oSubmit, "width")
$h = _IEPropertyGet($oSubmit, "height")
MouseClick("left", $x + ($w/2), $y + ($h/2))

; Wait for Alert window, then click on OK
$popupTitle = "Windows Internet Explorer"
$popupText = "ExampleFormSubmitted"
WinWait($popupTitle, $popupText)
ControlClick($popupTitle, $popupText, "[CLASS:Button; TEXT:OK; Instance:1;]")
_IELoadWait ($oIE)

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

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