Page 1 of 1

Screenshot method

Posted: Fri Feb 15, 2013 12:00 am
by omayer
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);
			
			}
			
		 }

Re: Screenshot method

Posted: Mon Feb 18, 2013 1:12 pm
by Support Team
Hi,

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

Regards,
Markus

Re: Screenshot method

Posted: Mon Feb 18, 2013 6:35 pm
by omayer
I am working w/4.01, didn't use anywhere Report.Setup(...)in code

Re: Screenshot method

Posted: Tue Feb 19, 2013 5:18 pm
by Support Team
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

Re: Screenshot method

Posted: Fri Apr 12, 2013 1:52 pm
by Zhilll
Has there been a resolution with this? I am experiencing the same problem. I am using Ranorex version 4.0.2.

Re: Screenshot method

Posted: Mon Apr 15, 2013 2:28 pm
by Support Team
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

Re: Screenshot method

Posted: Fri Jun 21, 2013 10:44 am
by kulasov
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"

Re: Screenshot method

Posted: Tue Jun 25, 2013 12:55 pm
by Support Team
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)