Forum Discussion

Arman's avatar
Arman
New Contributor
3 years ago

Testcomplete: how to get captured screenshot from 'Picture' panel in logs

I'm generating own log export to pdf by using fpdf. I'm trying to get captured screenshot after click from 'Picture' panel in 'Test Log'. I could get name and status from 'Log Items'. I've tried to check 'Picture' panel's DataType, but it returns 'float' instead of 'image'

logsCol = Project.Logs
logItem = logsCol.LogItem[0]
num = logItem.ChildCount

if num > 0:
  for i in range(0, num):
    name = logItem.Child[i].Name
    status = logItem.Child[i].Status

    #checking 'Picture' panel data type
    #here need to get captured screenshot
    screenType = logItem.Child[3].Data[0].Scheme.Child[0].DataType

    data = [[name, screenType, status]]
  
    #adding data to table
    for row in data:
      for datum in row:
        pdf.cell(3.7, 2*th, str(datum), border=1)
      pdf.ln(2*th)

pdf.output('Path to exported log\\TestReport.pdf', 'F')

Is it possible to get screenshot from TestComplete? (the option to get from the log folder is not suitable)

2 Replies