internet explorer - C# SHDocvw.dll Internetexplorer always Busy -
i'm trying automate ie in c#. problem it's busy.
i have wait-method
private void waitforcomplete() { int elapsedseconds = 0; bool isdocumentbusy = browser.busy; int timeoutseconds = 5; while (browser.busy && elapsedseconds < timeoutseconds) { thread.sleep(1000); elapsedseconds++; } }
and 1 of methods
public bool forward() { if (browser == null) return false; int loopcount = 10; while (browser.busy && loopcount > 0) { thread.sleep(500); loopcount--; } browser.goforward(); return true; }
i tried both sleep in method , wait-method.
i have methods switching tabs or create new tabs etc. it's same every method.
do have clue whats point of problem?
thanks!!!
ok found solution.
the wait-method correct
private void waitforcomplete() { int elapsedseconds = 0; int timeoutseconds = 5; while (browser.readystate != tagreadystate.readystate_complete && elapsedseconds != timeoutseconds) { thread.sleep(1000); elapsedseconds++; } }
it worked me this.
Comments
Post a Comment