achand
13 years agoContributor
capturing entire page
If there any way we can capture entire page, the page scroll bar.
- 13 years ago
I'm getting blank page while using page.PagePicture method. Kindly help.
Function TakeFullScreenshot(page) Dim screenshot screenshot = Project.Variables.REPORTPATH&"\\" & aqConvert.DateTimeToFormatStr(aqDateTime.Now(), "%m%d%Y_%H%M%S") & ".jpg" page.PagePicture().SaveToFile screenshot TakeFullScreenshot = screenshot End Function
Hi,
Just to be on the safe side: does the page exist and is rendered in the browser when you are taking screenshot?
Can you provide a code snippet that calls TakeFullScreenshot() function?
Hi Alex,
Yes, The page was fully loaded. It is a new customer registration form (CRM) where I've filled up all the values and before submitting the form, want to capture the entire page screenshot.
Dim uMobile, CustomerPanel Set uMobile = Aliases.browser.pageUmobile3 v1 = GetIDType(getDicValue("IdType")) Log.Message(v1) Call uMobile.Panel(1).TextNode(v1).WaitProperty("VisibleOnScreen", True, 2000) Call uMobile.Panel(1).TextNode(v1).Click() ... ... <code to fill the new customer registration form> ... ... ... 'Click on ok button Call uMobile.Panel(23).Panel(1).Panel(0).Panel(0).Panel(2).Panel(0).Button(1).Click() Delay 1000 set nxtbtn = customerForm.Form(1).Panel(1).Panel(0).Panel(0).Panel(0).Panel(0).Button(1) ' Take screenshot of the full form before submitting screenshotPath = ExtentManager.TakeFullScreenshot(uMobile) Call ExtentManager.passTestWithScreenshot(Project.Variables.CURRENTTCID , Project.Variables.CURRENTTCDESC, screenshotPath) 'Click "Next" button on the customer registration form Status = SafeClick(nxtbtn, 500, "Next button not found in the e registration form") If Not Status Then NewRegistration_Dealer = Status Exit Function End If 'click on Next Call customerForm.Form(1).Panel(1).Panel(0).Panel(0).Panel(0).Panel(0).Button(1).Click()
Hi,
Well... While I see Delay(1000) after OK button click and really hope that the page was loaded and rendered within this second, I would recommend this:
-- Add <page>.Wait() call after the click. This will wait for the page source to be received from the server. Note, that this will not wait for the objects obtained via additional requests sent from page script code. If you need to wait for such objects this must be coded explicitly. I.e.: add this line after the call to .Click() - uMobile.Wait()
-- In order to ensure that page has been rendered by the time the TakeFullScreenshot() function is called, add this line before the call to TakeFullScreenshot(): Call Log.Picture(uMobile.Picture()) (or Log.Picture(uMobile.Parent.Picture()) ) - this should log the visible part of the page, so you will be able to verify that page displays some content.
P.S. Some improvements in the .PagePicture() method were implemented in the recently released TC 14.30 - you may consider to update.