Forum Discussion

hlalumiere's avatar
hlalumiere
Regular Contributor
13 years ago

Web testing downloads under Google Chrome...

So I have a web application I need to test downloads of. I can initiate the downloads fine under all browsers, but how do I check for completion? Out of the three browsers only the Firefox downloads window can be reliably addressed by TestComplete. In IE9 I can address the downloads bar once in a while through MSAA, and in Chrome I cannot see it in the object browser at all. And even then, I cannot figure out how to read the status of the download in any of the three browsers...



It seems like my only alternative is to start the download, wait an arbitrary amount of time, and hope that the download is finished when I open the file?



Note that I cannot download the file manually through WGET or whatever as this is an ASP.Net page that creates the file to download dynamically.



Am I just out of luck here? Don't IE, Firefox, and Chrome expose some event that their addons can hook into?

  • Hi Hugo,


     


    All browsers are using different download managers. I'm afraid you will have to create different scripts for each browser to download the file from GUI.


     


    BTW,


    Note that I cannot download the file manually through WGET or whatever as this is an ASP.Net page that creates the file to download dynamically.


     


    I don't quite understand this. From your page, you can get the link to the file and use the MSXML2.XMLHTTP object to download the file without using browsers. Here is the example from our How To section: Download a file from the Internet 


     

  • hlalumiere's avatar
    hlalumiere
    Regular Contributor
    I don't quite understand this. From your page, you can get the link to the file and use the MSXML2.XMLHTTP object to download the file without using browsers. Here is the example from our How To section: Download a file from the Internet






    No I cannot, as the download is a dynamically generated file. The file does not exist until I click the link. When I do click the link, the ASP page generates the file then PUSHes the file to the client. The server initiates the download, not the client.



    But anyways this is a non issue now, I check if the downloaded file exists (or if the .part file does not, in the case of Chrome and IE).



    The main issue I have now is that Chrome 22.0.1229.94 is being a big PITA under TestComplete 9.10. Originally everything seems to get detected properly, the extension is installed and all. But then the Browser.ToUrl method does not work, and after I try it the Chrome extension just stops working. It is still listed as installed and enabled, but whenever I try the object spy a balooon pops up in Chrome saying "TestComplete Chrome extension is not installed or is disabled".  The extension IS installed, and according to chrome IS enabled (the chrome task manager lists it as running in one of its 3 processes), but TestComplete does not recognize it, and will not until I manually remove and reinstall the extension. At which point object spy works again, but again I cannot navigate to any page, and after trying to I have to again reinstall the extension...



    I am going to try other older versions and see if I can get it to work.



    As a sidenote, don't you think it's a bit impractical to have to have a different extension for every Chrome version? Google pushes out a new Chrome every 2 days, yet you have a hard time releasing one update per year. Please start releasing Chrome extensions independantly from TestComplete and more regularily.
  • hlalumiere's avatar
    hlalumiere
    Regular Contributor
    I just found the solution to the previous problem.



    In order to start a clean copy of the browser for every test, I was deleting the cache and history before starting up the browser. In the case of Chrome, those files are in %LOCALAPPDATA%\Google\Chrome\User Data\Default. I was already keeping the Preferences file, but was deleting everything else. Turns out if you delete either (or both) the "Extension State" and "Extensions" folder, the TestComplete extension is still installed but missing the scripts it needs to access the browser.



    It would be good to add a check for those files upon starting the extension, and restore them when needed. Or at least throw a message, or disable the extension if the files are missing.
  • I have the same problem.



    Is there any way to detect the downloads bar in Google Chrome?