public static string GetPageObjectFunctionName()
{
string functionName = "";
System.Diagnostics.StackTrace callStack = new System.Diagnostics.StackTrace();
System.Diagnostics.StackFrame[] frames = callStack.GetFrames();
foreach (System.Diagnostics.StackFrame frame in frames)
{
if (frame.GetMethod().ToString().Contains("PageObject"))
{
functionName = frame.GetMethod().ReflectedType.Name + "." + frame.GetMethod().Name.ToString();
}
}
return functionName;
}
Excellent Post. Also visit http://whiteboxqa.com/selenium.php
ReplyDeleteReally useful.Thanks.
ReplyDeleteYou may also visit for similar articles at http://testocean.blogspot.in