Screenshot method

Class library usage, coding and language questions.
omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Screenshot method

Post by omayer » Fri Feb 15, 2013 12:00 am

I am not getting the screenshot on report, am i missing anything or easier way to get the screenshot when testcase pass or fail

ValidationStaticClass.ValidationPageLoaded("/dom[@caption='Smart Search']//tabpage[@title='Smart Search']","Verify Smart Search Page loaded");


Code: Select all

public static void ValidationPageLoaded(string rxPath, string textMessage)
		{
		 Ranorex.TabPage tabPageObject = null;
		 bool found=false;
		 found = Host.Local.TryFindSingle<Ranorex.TabPage>(rxPath, 60000, out tabPageObject);   
		
			if (!found)   
			{   
			    throw new Ranorex.ElementNotFoundException(textMessage, null);                   
			}   
			else  
			{ 	//found the page
				tabPageObject.EnsureVisible();
				Report.Screenshot(textMessage,rxPath);
			
			}
			
		 }
Tipu

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Screenshot method

Post by Support Team » Mon Feb 18, 2013 1:12 pm

Hi,

Are you working with the old (2.X) reporter (do you somewhere use Report.Setup(...)in code)?

Regards,
Markus

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Screenshot method

Post by omayer » Mon Feb 18, 2013 6:35 pm

I am working w/4.01, didn't use anywhere Report.Setup(...)in code
Tipu

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Screenshot method

Post by Support Team » Tue Feb 19, 2013 5:18 pm

Hi,

Can you post or send us the generated Report file?
Are you sure the method is executed, have you already tried to debug it?
Could you test if it works with the current Ranorex version (4.0.2)?

Regards,
Markus

Zhilll
Posts: 13
Joined: Thu Oct 06, 2011 2:48 pm

Re: Screenshot method

Post by Zhilll » Fri Apr 12, 2013 1:52 pm

Has there been a resolution with this? I am experiencing the same problem. I am using Ranorex version 4.0.2.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Screenshot method

Post by Support Team » Mon Apr 15, 2013 2:28 pm

Hello,

Could you please give us more information about that issue?
Could you please try to create a new solution and write the following line into the UserCode file.
Report.Screenshot();
This method should log a message containing a screenshot of the whole desktop.
If this works please check the parameter of your method which doesn't work.
Is it possible to set a break point at the specific line? Does the execution sop when you run the project in the debug mode?

Regards,
Bernhard

kulasov
Posts: 1
Joined: Fri Jun 21, 2013 10:22 am

Re: Screenshot method

Post by kulasov » Fri Jun 21, 2013 10:44 am

I use trial version of Ranorex 4.0.4
Windows 7 - 64bit
VisualStudio 2010

this code doesn't work for me

Code: Select all

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Ranorex;

namespace TestProject2
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            Report.Screenshot();
        }
    }
}
Files "Ranorex.rxlog" and Screenshot don't appear after execution.

ps: "excuse me for my bad english"

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Screenshot method

Post by Support Team » Tue Jun 25, 2013 12:55 pm

Hello,

It looks like that TestReport.Setup() is missing in your project.
Could you please try to use the following lines of code?
[TestMethod]
public void TestMethod1()
{
	TestReport.Setup(ReportLevel.Info, "MyReport.rxlog", true, true, 50);
	Report.Screenshot();
	Report.End();
}
Regards,
Markus (T)