Sign in to follow this  
Followers 0
Extreme

How to detect if Submit button was clicked?

9 posts in this topic

I am trying to capture and show html Form data after user has submitted it, but for some reason it doesn work :\

This was my first attempt, to get whole "locationurl" and then use string functions to display form objects,

but this way of "locationurl" doesn't seem to work with frameset, and I don't know why :\

#include <IE.au3>

$url="http://www.hm.com"

$oIE = _IECreate()
_IENavigate($oIE, $url)

 While $oIE.busy
     Sleep (30)   
 WEnd

$oFrame = _IEFrameGetObjByName($oIE, "login_frame"); get a reference to the contents frame 
$oEvt = ObjEvent($oFrame, "EVT_") 

Func Evt_navigatecomplete()
    MsgBox(0, "Message", _IEPropertyGet($oFrame, "locationurl") & @CR)
EndFunc

Second thing I could possibly do is capturing "event" when submit button is clicked, but I don't know how to do that :\

Share this post


Link to post
Share on other sites



just a quick view, i noticed..

MsgBox(0, "Message", _IEPropertyGet($oFrame, "locationurl") & @CR)

should be "the object"

MsgBox(0, "Message", _IEPropertyGet($oIE, "locationurl") & @CR)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

But URL in addressbar remains unchanged when Submit is pressed..

Anyway, neither way shows MsgBox, and scripts just exists..

Share this post


Link to post
Share on other sites

Actually, since he is wanting to work with the frame contents, the $oFrame reference would be what he wants.

What messages are written to the SciTe console when you run this? I think you'll get a NoMatch... I don't see any frames on this page...

Use this to insure you are seeing the current source in case there is dynamic content:

ConsoleWrite(_IEDocReadHTML($oIE) & @CR)

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

$oFrame = _IEFrameGetObjByName($oIE, "login_frame")

there is no "login_frame"

8)

too slow!!!

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

HM.COM was just an bogus example, not real example.. I should have been more clear on that.. Anyway, I am posting rewritten script and you can check with real live website:

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.gitacomputer.com/sale/site/index.html")

While $oIE.busy
     Sleep (30)   
WEnd
While WinExists(_IEPropertyGet($oIE, "hwnd"))
    Sleep(10)
WEnd


$oFrame = _IEFrameGetObjByName($oIE, "loginframe"); get a reference to the contents frame 
$oEvt = ObjEvent($oFrame, "EVT_") 

Func Evt_navigatecomplete()
    MsgBox(0, "Yeah", _IEPropertyGet($oFrame, "locationurl") & @CR)
EndFunc

Share this post


Link to post
Share on other sites

What messages are written to the SciTe console when you run this?


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

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Nothing really... It opens frameset, and I fill out and submit a form, but nothing happens.. Only when I close IE window, I get something in the console:

>"H:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "H:\Documents and Settings\Sale\Desktop\AutoIT\ie3.au3"

--> IE.au3 Error from function _IEPropertyGet, $_IEStatus_InvalidObjectType

--> IE.au3 Error from function _IEFrameGetObjByName, $_IEStatus_InvalidObjectType

>Exit code: 0 Time: 28.026

Can you post an example of how I would be able to catch onclick Event of Submit button? Maybe that approach will be more fruitfull?! For ex. when onclick happens, I just go through all form objects and display them..

Edited by Extreme

Share this post


Link to post
Share on other sites

I think this is an error with ie.au3 since everything is working fine otherwise, but with Frames involved, nothing is working :whistle:

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