Sign in to follow this  
Followers 0
jdnx

Questions About different Html Page redirecting

4 posts in this topic

I want to accomplish such task as follows:

first in one html page(let's call it page1) , input something in a textbox,then press enter to submit the page,but after submitting,this page redirects to another page(page2),in this page ,press another button,and then a MessageBox prompts,I should press OK,and then the browser redirects back to the first page(page 1),one round ends,and I can begin a second round.

$oIE = _IEAttach("xxx");
$oFrames = _IEFrameGetCollection ($oIE,2)
$oForm = _IEFormGetObjByName ($oFrames, "pageForm")
$oConfirmNo = _IEFormElementGetObjByName ($oForm, "confirmNo")
_IEAction ($oConfirmNo,"focus");
$hwnd = _IEPropertyGet($oIE, "hwnd")
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{BS 20}{DEL 20}")
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "000002205822{Enter}")
_IELoadWait ($oFrames) ; here causes the problem

There is a problem,after I press enter in a textbox in Page1,I should wait for submitting process to complete to continue next steps,but IELoadWait($oFrames) doesn't function properly,I think it's because page1 redirects to page2,so here I should wait for page2,since here pages seem to wrap in frames ,how should I write code to fulfill my goal?

Thanks in advance for help.

Share this post


Link to post
Share on other sites



You can check the URL with _IEPropertyGet($oFrames, "locationurl") and once it changes to page 2, call _IELoadWait again.

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

You can check the URL with _IEPropertyGet($oFrames, "locationurl") and once it changes to page 2, call _IELoadWait again.

Dale

Thanks!

You mean the codes should be like this:

$oIE = _IEAttach("xxx");
$oFrames = _IEFrameGetCollection ($oIE,2)
$oForm = _IEFormGetObjByName ($oFrames, "pageForm")
$oConfirmNo = _IEFormElementGetObjByName ($oForm, "confirmNo")
_IEAction ($oConfirmNo,"focus");
$hwnd = _IEPropertyGet($oIE, "hwnd")
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{BS 20}{DEL 20}")
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "000002205822{Enter}")
while(_IEPropertyGet($oFrames, "locationurl")!="page2_url")
wend
_IELoadWait ($oFrames)
;Next step

That means although the content page of the frame changes , there is no need to reuse _IEAttach and _IEFrameGetCollection ??

Share this post


Link to post
Share on other sites

Thanks!

You mean the codes should be like this:

$oIE = _IEAttach("xxx");
$oFrames = _IEFrameGetCollection ($oIE,2)
$oForm = _IEFormGetObjByName ($oFrames, "pageForm")
$oConfirmNo = _IEFormElementGetObjByName ($oForm, "confirmNo")
_IEAction ($oConfirmNo,"focus");
$hwnd = _IEPropertyGet($oIE, "hwnd")
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{BS 20}{DEL 20}")
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "000002205822{Enter}")
while(_IEPropertyGet($oFrames, "locationurl")!="page2_url")
wend
_IELoadWait ($oFrames)
;Next step

That means although the content page of the frame changes , there is no need to reuse _IEAttach and _IEFrameGetCollection ??

Anyone can give any suggestions ? Thanks

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