in reply to Win32:: How to tell when Default browser url has loaded

Yes, Try Win32::IEAutomation & Win32::GUITest
Raghu
  • Comment on Re: Win32:: How to tell when Default browser url has loaded

Replies are listed 'Best First'.
Re^2: Win32:: How to tell when Default browser url has loaded
by TAHAIC (Novice) on Dec 12, 2008 at 23:50 UTC
    imrags

    Could you explain that code for me I am not quite sure how it works. Which modules does it require.

    I am already using Win32::GuiTest for the keystrokes, this part is working fine.I am also using the WaitWindow function for checking a standard application window but it dosen't seam to work with the browser window, or I'm doing something wrong. Also I noticed that the title of the browser appears before the page has finished loading.

    I have tried WaitWindowLike for a child process of a normal application window but I don't seam to be able to get it to work, some help with that would also be appriated.

    I was thinking that I could use Win32::API to import a win32dll function that would do the job, but I'm not sure which one to use...considering I don't want to force the user to use IE.

      Ok...Sorry to disappoint you but this function was written for IE and the object $agent was for a Win32::IEAutomation object.
      This is for a webpage which has javascript and if it takes some time to load (for e.g. if you are searching for something on a website and it says "Searching ... or Please Wait while we search")...
      In this case the page is not completely loaded, hence you would have to wait for the page to complete.
      That's when this code will come into picutre...
      I'm not sure but I think You can replace the $agent for any Win32 Module you are using to load the page...
      Raghu
        Firstly...there are no disappointments here...only wisdom shared between members!!...Thank you for your input!!

        Secondly I am using Win32::Process to launch the default browser as follows-

        my $ShellExec = Win32::API->new('shell32', 'ShellExecute', 'NPPPPI', 'N') or die "cannot import ShellExecute: $!\n";

        my $DefaultBrowser = $ShellExec->Call(0, "open", "http://SomeWebSiteURL", "", ".", SW_SHOWNORMAL);

        if ($DefaultBrowser < 33) {

        print STDERR Win32::FormatMessage($DefaultBrowser), "\n";

        exit(1);

        }

        I got this from another posting ...can't remember where...& I am not sure what the 'NPPPPI', 'N' bit is but it seems to work....that is: load the default browser!

        I have the handle $DefaultBrowser to browser object window allowing me to control it!....I should be able to do as you have suggested ..that is: the $agent->ReadyState...

        I will have to spend some time experimenting and trying operation with different default browsers which will take some time....I will post back as soon as I can!

        If anyone else has any more input in the mean time it would be greatly appreciated to all members of the monastery.

        TAHAIC

        I'm not sure what happened to my last post here.