I have couple of items that I need suggestions on. Please take a look at below
We have been automating the tests using browser library, however, ‘Take screenshot’ with ‘fullpage’ argument passed as ‘true’ does not take screenshot of full page instead takes screenshot of the application readily visible in viewport. Could someone assist us on this?
Since the full page screenshot is not working, for time being, we are resizing the view port to 1920*2500 before taking the screenshot which would enable us see some part of the page. However, We are not able to reset the dimensions to previous state (previous state being maximized browser window). Is there a way to reset the view port size to previous state?
It would be helpful if someone can provide some insights on any of these points. Please do let me know for additional details
Before resizing the view port to 1920*2500, perhaps using Get Viewport Size first might be a good ides, then you can set it back to the size equivalent of “full screen”?
I also noticed that Take Screenshot has a fullPage option that defaults to false, setting it to True may help you?
@yadubhushanTake Screen with the option fullPage set to true does take a screenshot of the full page. If tested it myself because I had an similar situation where I thought it didn’t. The cause was that some content in an div had a scrollbar, so that only way to make this visible was to increase the viewport size.
Sounds like the issue could be in lazy loading ? eg, content outside of current viewport does not get loaded before it becomes part of the viewport - maybe try the suggestions on this thread: Scroll to Element , Scroll By, and Scroll To is not working
Thanks for the response. ‘Get Viewport Size’ keyword returns ‘none’ if the browser is maximized. Hence, We cannot get the dimensions to set it back to previous state. That is where I have been stuck on. If it returns the dimensions, We would probably use the same to go back to previous state using ‘Set Viewport Size’
Thanks for your response. You are right. We are able to see full screenshot when we increased the view port size to 1920x2500. However, We are not able to reset it back. While launching the browser we are maximizing it by setting ‘viewport’ to None while calling ‘New Context’ keyword. It sets browser dimensions to None. As discussed, For taking full screenshot we got to resize it to 1920x2500. As a result of this resize, We could not see few pop-ups during the execution. To avoid this issue, We have trying to reset the view port size to initial state (scale to window) which is not happening. Please let us know if we have any workarounds for this
I would not use None as a viewport size when creating a new context, but rather something like:
Open Browser
VAR ${hd_viewport} {'width': '1920', 'height': '1080'}
New Browser headless=False
New Context viewport=${hd_viewport}
And then resize the viewport to another size when necessary. That way you know what your viewport size was in the beginning and it’s easy to go back to this size.