Ask a Question

TestComplete : Unable to capture complete screenshot in the disconnected remote desktop

SOLVED
nimishbhuta
Frequent Contributor

TestComplete : Unable to capture complete screenshot in the disconnected remote desktop

Hello, 

 

I am using TestComplete Picture object to take the screenshot, save in the clipboard and then save into the excel file sheet. 

Below is the sample code :- 

Set oPict=Sys.Browser("iexplore").BrowserWindow(arg_BrowserID).Picture
Call oPict.SaveToClipboard()

Call func_PasteScreenshotinExcelSheet(var_ReportFileLocation,3)  ( In this case 3 is the sheet id, meaning it is shored 3rd sheet) 

 

Function func_PasteScreenshotinExcelSheet(arg_FileName,arg_SheetID)
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False
objExcel.DisplayAlerts = False
Set objWorkbook = objExcel.Workbooks.Open(arg_FileName)
Set objWorkSheet=objWorkbook.Worksheets(arg_SheetID)
objWorkSheet.Activate
objWorkSheet.Cells(intTopRange-3,1).value=strBusinessOperation
objWorkSheet.Cells(intTopRange-3,1).font.bold = True
objWorkSheet.Cells(intTopRange-3,2).value="Status: "&strBusinessOperationStatus
If lcase(strBusinessOperationStatus)="pass" Then
objWorkSheet.Cells(intTopRange-3,2).Interior.ColorIndex = 4
Elseif lcase(strBusinessOperationStatus)="fail" Then
objWorkSheet.Cells(intTopRange-3,2).Interior.ColorIndex = 3
End If
'Ws.Range("A"&intTopRange).Select
Delay(500)
objWorkSheet.Paste(objWorkSheet.Range("A"&intHeightStartRange&":"&"A"&intHeightEndRange))
objWorkSheet.Range("A1:IV200").EntireColumn.AutoFit
intHeightStartRange=intHeightEndRange+6
intHeightEndRange= intHeightStartRange+55
intTopRange=intHeightStartRange
objWorkbook.Save
Set objWorkbook=Nothing
objExcel.Quit
Set objExcel=Nothing

 

I am able to capture the whole image of the browser,save into clipboad  and it is pasted in the excel file when I am connected to the remote desktop. 

But if  I disconnect the remote desktop using tscon command by running as admimistrator then it captures the part of the image which is saved in the clipboard and pasted in the excel sheet.   

Below is the tscon command,which is in the batch format and run as administrator for disconnecting remote desktoop :- 

 

for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
%windir%\System32\tscon.exe %%s /dest:console
)

 

Can you please let me know how to have the whole image captured during the disonnected remote machine?

 

Regards,

 

Nimish

 

 

 

 

8 REPLIES 8
Marsha_R
Champion Level 3

Once you have disconnected from the remote desktop, you don't have access to TestComplete any more.  You're getting what the system has left, which is the clipboard.  

 

What are you trying to accomplish by disconnecting from the remote desktop?  Why not finish saving the picture in TestComplete and then disconnect after that?

nimishbhuta
Frequent Contributor

Basically,I am creating custom excel report and storing the screenshot of the failure and some important passed one.

In the disconnected mode,it is taking the screenshot but partially.

Regards,

Nimish

Hi,

 

Note, that the mentioned tscon command does not close your UI session, but switches it to admin console one which can have different screen resolution than yours. I am not sure about the details, but can imagine the situation, when the size of the browser window remains the same and thus, on the lower screen resolution, part of the window appears out of desktop viewport, thus is not captured and creates impression of partial screenshot.

Does this look like the reason?

Another note: As you are working with web browser and if you are not interested in browser's window itself, you may consider .PagePicture() method instead. This method takes screenshot of complete web page scrolling it automatically.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
nimishbhuta
Frequent Contributor

Hi, 

 

I tried with the PagePicture method but the result is the same it shows partial image. As, I am using tscon it command it shows desktop console of that virtual machine, so not sure if it has become low resolution.

 

I have attached the file to show how the images looks with connected mode and disconnected mode. 

 

 

 

 

 

Hi,

 

Hm-m-m... I don't see any partial image. What I see is web page that does not fit into browser's viewport and thus must be scrolled using scrollbar.

I think that this is in line with my guess.

Try to shrink browser window and check if scroll bar appears. Then talk to your designers/developers and ask them how page must respond when the size of the viewport is changed. Considering that not the whole page must be scrolled but just a part of it I think that .PagePicture() method will not help in your case.

At the moment I am pretty sure that desktop resolution set in the Administrator's profile is less then the resolution set for your current user profile.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
nimishbhuta
Frequent Contributor

Hi, 

 

May be you are right that it is the administrator user profile is having less resolution than my current user. I checked with the System guys but they don't have access to physcial machine to change the resolution. My question is there any way we can change the resolution as my user is having admin privileges or can we run the tscon command with my user with admin privileges. I tried using the tscon command with my user but it says access denied. 

 

Please let me know how should I go about this. 

 

Regards,

 

Nimish

 

Hi Nimish,

 

Yes, I think this is possible.

You may either make direct changes to the Windows Registry for the settings that specify screen resolution for Administrator or try Robert's suggestion from the https://community.smartbear.com/t5/TestComplete-Functional-Web/Why-screen-resolution-becomes-smaller... thread.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
nimishbhuta
Frequent Contributor

Hi All, 

 

I have found the solution which is working correctly, we need to make changes in the registry to change the resolution as per our requirement when using tscon for desktop console. 

 

https://community.smartbear.com/t5/TestComplete-General-Discussions/Screen-Resolution/m-p/181508

 

Regards,

 

Nimish 

cancel
Showing results for 
Search instead for 
Did you mean: