Forum Discussion

Mike359's avatar
Mike359
Contributor
1 month ago

page.PagePicture - Screenshot duplication

Hi everyone,

I seem to have an intermittent issue when using the method page.PagePicture(0,0,-1,-1) with Oracle Cloud Applications.

If I try to capture a screenshot of a full page (e.g., var shot = page.PagePicture(0,0,-1,-1)) where the canvas spans more than what is displayed onscreen, and then save that screenshot to Stores Regions (e.g., Regions.AddPicture(shot, "My Screenshot")), I will intermittently get a screenshot where the top part of the screen is duplicated, and the bottom is truncated. Rather than getting a full screenshot, the result is incomplete.

As I mentioned, this issue is intermittent and seems to be related to the speed at which the webpage reacts to the page.PagePicture(0,0,-1,-1) method call.

To address this, I’ve tried the following steps to slow down the process:

  • aqUtils.Delay(3000);
  • Options.Web.CSSTransitionForPagePicture (tested with both true and false)
  • Options.Web.WebPageLoadingTimeout = 120000;
  • Options.Run.Delay = 500;
  • page.Wait(10000);
  • page.Keys("[Esc]");

Unfortunately, none of these have resolved the issue.

Questions:

  1. Am I missing any additional settings or methods that could help ensure the full page is captured consistently?
  2. Has anyone else experienced a similar issue with page.PagePicture(0,0,-1,-1) in Oracle Cloud Applications or other web applications?

Any insights or suggestions would be greatly appreciated!

Thank you in advance for your help.

10 Replies

    • rraghvani's avatar
      rraghvani
      Icon for Champion Level 3 rankChampion Level 3

      I've just tried this using the following code,

      function test()
      {
          var page = Sys.Browser("chrome").Page("https://getbootstrap.com/docs/4.0/components/dropdowns/");
          
          var picture = page.PagePicture(0, 0, -1, -1);
          // Posts the image to the test log
          Log.Picture(picture);
      }

      and it works,

      Reasons for it may not work, is mentioned in PagePicture Method (Page Objects) 

  • Hi, Thank you for replying. I have tried the solution many times and as I stated this is an  intermittent error no matter what settings I apply. Here are some redacted screen shots of what happens when I run the test several times without changing any code:

    Expected Output:

    Occasionally I will get this Unexpected output (with no changes in code):

    As you can see it is repeated [Note: I manually redacted data on the screenshot in obvious places for Data Protection reasons]

    • rraghvani's avatar
      rraghvani
      Icon for Champion Level 3 rankChampion Level 3

      What you have shown is what is explained in the Remarks section in the link that I had provided, relating to "sticky" elements.

      Try using Options.Web.CSSTransitionForPagePicture property to see if that helps.

      • Mike359's avatar
        Mike359
        Contributor

        Thanks, but that was the first thing I did. :( 

        • Options.Web.CSSTransitionForPagePicture (tested with both true and false)

         

        (as per above) - BTW the heading in OracleCloud Applications is not sticky.

    1. I have also tried scrolling to the bottom of the screen then back up before taking the screenshot.
    2. Waiting for page to load. (aqUtils.Delay, Sys.Desktop.Refresh, page.BringToFront,  Options.Run.Delay,  page.ToUrl(page.URL), plus others )
    3. Calculating its height and width values and passing those in instead of -1. 
    4. Started at pixel 1 rather than 0 ie page.PagePicture(1,1,-1-1) 

    All of which made no difference (I am now considering using other methods to perform a full page extract, but this required access to DotNet libraries or ImageMagic being installed. Ideally I do not want to do that). These types of issue are difficult to reproduce by others, making it hard to identify and fix. Especially if others have not experienced he same.

    However, any other suggestions or TC methods I can use would be gratefully received.  

    Thanks In advance