Sign in to follow this  
Followers 0
IgorChete

Script doesn't work because of browser lag.

10 posts in this topic

#1 ·  Posted (edited)

Here's a problematic part of my code:

Sleep(1000)
$oInputs = _IETagNameGetCollection($oIE,"input")
For $oInput In $oInputs
if $oInput.value = "Submit" Then 
_IEAction($oInput,"click")
ExitLoop
EndIf
Next

It clicks the button succesfully, but sometimes, because of browser lag when a page is loading, it skips the whole part and doesn't click. Can i somehow make it get collections of 'input' tags until it finds one with the value "Submit", clicks it and then breaks the While loop?

Edited by IgorChete

Share this post


Link to post
Share on other sites



Instead of the sleep, suggest you use

_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

Share this post


Link to post
Share on other sites

Thanks for the reply, but that doesn't solve my problem, the button i click and the lag are from a Javascript script inside the page. I should have said that in my opening post.

What i think the solution might be is to read all 'input' type buttons until a button with the 'Submit' value is found. I don't know how to code that though.

Share this post


Link to post
Share on other sites

I fixed my own problem.

old code :

Sleep(1000)
$oInputs = _IETagNameGetCollection($oIE,"input")
For $oInput In $oInputs
if $oInput.value = "Submit" Then 
_IEAction($oInput,"click")
ExitLoop
EndIf
Next

new, working code:

$tmp=0;
While $tmp=0
$oInputs = _IETagNameGetCollection($oIE,"input")
For $oInput In $oInputs
if $oInput.value = "Submit" Then 
_IEAction($oInput,"click")
$tmp=1;
ExitLoop
EndIf
Next
WEnd
_IELoadWait ($oIE)

Share this post


Link to post
Share on other sites

I am trying to get the frame contents of a IE screen, but the script is not waiting until the inner frame is loaded. Need help

Share this post


Link to post
Share on other sites

I am trying to get the frame contents of a IE screen, but the script is not waiting until the inner frame is loaded. Need help

Your question is much to vague. what about posting the script that is giving/showing the issue you have?

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Your question is much to vague. what about posting the script that is giving/showing the issue you have?

Here is the script

; submit the page with iframe

$o_submitButton1 = _IEFormElementGetObjByName($o_checkForm,"Submit")

_IEAction ($o_submitButton1, "click")

;; Need to wait for the page to reload with the data

Do

Sleep(1000)

$o_IE2 = _IEAttach("Request Statements","html")

$iError = @error

MsgBox(0,"_IEAttach Loop" , _IEPropertyGet($o_IE2,"title"))

Until $iError = 0

But the screen never gets loaded as long the script is executing

Share this post


Link to post
Share on other sites

Did you even bother to read the code right above your first post or for that matter any of this thread at all?

If the browser if IE then see the part about _IELoadWait ($oIE).


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I did try _IELoadWait() , but it did not make any difference

Edited by greenhombre

Share this post


Link to post
Share on other sites

I did try _IELoadWait() , but it did not make any difference

Show your entire script for see where you place _IELoadWait ($oIE) !


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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