// Get URL variable of currect page as per the object we set public static string GetStoredPageUrl() { AllPageBase allPages = GetObject(); Type type = allPages.GetType(); var property = type.GetProperty("url"); var propertType = property.PropertyType; var propertyValue = property.GetValue(allPages); if (propertType == typeof(string)) { return(propertyValue as string); } else { return(null); } }
// Get Web element value of currect page as per the object we set public static IWebElement GetWebElement(string elementName) { // removing White spaces from Page Name elementName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(elementName); elementName = Regex.Replace(elementName, @"\s+", string.Empty); AllPageBase allPages = GetObject(); Type type = allPages.GetType(); var property = type.GetProperty(elementName); var propertType = property.PropertyType; var propertyValue = property.GetValue(allPages); if (propertType == typeof(IWebElement)) { return(propertyValue as IWebElement); } else { return(null); } }