Wait for webbrowser-java to finish
I am playing around with web automation and have a problem.
I am clicking a "java button" (I think it is called that) and that button shows a "java window" (a window which doesn't require the whole site to reload). I need to wait for this window to show before I continue with the execution of the code, but since the whole page isn't re-rendering the webBrowser_DocumentCompleted doesn't execute.
I only need to wait like a second, maybe even 500ms will do. I tried with Thread.Sleep, but that paused the webbrowser rendering too so it failed.
Any good method to solve this? :ehh:
Re: Wait for webbrowser-java to finish
Thread.Sleep is bad practice in the first place and does not "resolve" the problems.
what you need to do is try to find some client side event you an try to hook into and subscribe to that event. Perhaps the AttachEventHandler would work on the browser control (im not entirely sure but worth a shot)
http://msdn.microsoft.com/query/dev1...SHARP)&rd=true
Alternatively, if there is some output that this applet is giving, then after every few seconds keep interogating the browser to see if it has given the output you are after and if so... continue doing what you need to do. (using the System.Timers.Timer for regular elapsed timer, which is thread safe)
Re: Wait for webbrowser-java to finish
The browser is running a javascript to display a button, it is that I want to react on. But yeah, using a timer maybe is the best.