I've been thinking about having multiple page elements and making tabbing with a PageFactory. Then I realized it would be better to not to type all the types that I want, since I just wanna get the instance. Then I created something as follows:
public static T GetInstance<T>() where T:IPage, new()
{
return new T();
}
But the point is, I can just create my pages like new WelcomePage();
instead of PageFactory.GetInstance<WelcomePage>()
and it doesn't make sense to me to have a generic method like that. But I see it is something used before.
So, what is the benefit of using that generic way to get an instance. I'd be happy to hear, probable needs.