Jump to content

Script doesn't work because of browser lag.


 Share

Recommended Posts

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
Link to comment
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

Link to comment
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.

Link to comment
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)
Link to comment
Share on other sites

  • 1 month later...
  • Developers

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?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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

Link to comment
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!"

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