Results 1 to 3 of 3

Thread: Wait for webbrowser-java to finish

  1. #1

    Thread Starter
    Hyperactive Member Cyb3rH4Xter's Avatar
    Join Date
    May 2009
    Location
    Sweden
    Posts
    449

    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?

  2. #2
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    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)

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  3. #3

    Thread Starter
    Hyperactive Member Cyb3rH4Xter's Avatar
    Join Date
    May 2009
    Location
    Sweden
    Posts
    449

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width