Forum Discussion

dhundley's avatar
dhundley
Regular Contributor
2 years ago
Solved

navigating to pop up web page tab

i have just started working with a browser based application in testcomplete and I have encountered a situation where i'm clicking a print button on one page (tab) that generates a new browser tab. The URL of the new tab is "blob:https://<application url>/<guid>" and I need to click on a download button in the upper right corner of this page but the testcomplete "red box" does not surround the download button. instead it is around the entire page. in the object browser I can drill down and find the item shown here which contains the download icon

but when I try to insert a click event in my recording (using x,y coordinates on the image above) it clicks on those coordinates but on the original web page (where I did the click on the print button). how do i get test complete to navigate to the new tab (with a GUID as part of its URL) so that the click happens where it is supposed to?

  • ok. i have come up with a solution. not sure if it is the best method but, at least it appears to work. i replace this: 

    Browsers.Item(btChrome).Navigate(page.URL);

    with this:

    page.ToURL;

    and that resolved the "file couldn't be accessed" issue. then i had to map the entire blob file page (cause it doesn't have anything defined beneath it) and through trial and error I found the proper x,y coordinates that performed the click action in the correct place.

     

     

  • dhundley's avatar
    dhundley
    2 years ago

    that allowed the mapping of individual objects above the yellow line in the image shown here but it didn't open up anything below the line (which is where the download button is located). 

     
     

     

    i think i might be able to approach it from a different angle. if i change the chrome setting for PDFs to this (instead of "open pdf in chrome") then i can just find the pdf in my downloads folder and use it from there. I'll just have to rename it. Thanks for trying though. 

     

     

8 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    If you add the WndClass name to MSAA in Project Settings

    You'll be able to access the buttons, tabs, menu etc in Chrome.

     

    Also, disable this option

     

    • dhundley's avatar
      dhundley
      Regular Contributor

      i added WndClass to the MSAA and, just for good measure, i closed and reopened TestComplete

       

      but that webpage still does not allow me to drill down to the buttons. it's page does not have a little white arrow symbol next to it for expanding. the option you mentioned was already disabled. did i not do it correctly? am i still missing something?

       

       

  • dhundley's avatar
    dhundley
    Regular Contributor

    i read another post on the community forum about using the visibleonscreen property and I came up with the following javascript function which would theoretically pause the script execution until the new tab appears (while loop at line 364) and then navigate to it (line 370)

    but when i run this i end up getting this instead of the blob file page tab

     

    i have enabled the access to file URLs in the manage extensions for smartbear

    anyone know what might be causing this or anything else i can try?

     

     

    • dhundley's avatar
      dhundley
      Regular Contributor

      ok. i have come up with a solution. not sure if it is the best method but, at least it appears to work. i replace this: 

      Browsers.Item(btChrome).Navigate(page.URL);

      with this:

      page.ToURL;

      and that resolved the "file couldn't be accessed" issue. then i had to map the entire blob file page (cause it doesn't have anything defined beneath it) and through trial and error I found the proper x,y coordinates that performed the click action in the correct place.

       

       

      • dhundley's avatar
        dhundley
        Regular Contributor

        unfortunately, while my solution worked on my workstation, it fails when i run it on the VM where the automation executes because the x,y coordinates are not exactly the same. does anyone know of a way to download a pdf file from a blob type url to the computer without having to click on a download icon? i've tried right clicking on the webpage to bring up a context menu. there is a print option but not a download. is there anything i could do in a javascript function. any sort of "download" method available? thanks!

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Sorry, I should have been more specific! I was referring to the property value of WndClass,

     

     

    Use the Object Spy tool on Chrome window, and add the property value of WndClass to MSAA

     

    • dhundley's avatar
      dhundley
      Regular Contributor

      that allowed the mapping of individual objects above the yellow line in the image shown here but it didn't open up anything below the line (which is where the download button is located). 

       
       

       

      i think i might be able to approach it from a different angle. if i change the chrome setting for PDFs to this (instead of "open pdf in chrome") then i can just find the pdf in my downloads folder and use it from there. I'll just have to rename it. Thanks for trying though. 

       

       

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    That bar is part of Adobe, which I don't think TC supports.

     

    "Download PDFs" will be the better option - I thought it was this option!

     

     

    What about using keys Ctrl + S to save, which is the same as pressing the download button?