RE: How to pass single browser instance to different classes
How to pass single browser instance to different classes ,
Say Ex : I have Class A where i initialize browser and steps of test will be spread across different method defined in different class say Class B , Class C . But my Actual test method is written in Class D .
Here how can i use single instance , Because i can see null value in driver in subClasses .
Please do let me know if more Info required .
Hi Virender ,
Thanks for reply !!.
I’m aware of above pattern , but want to know how to make best use of it .
Form your answer i have few questions to make it more understandable .
1. DataProviderFactory is class which is written by you , i’mean some custom class not Selenium , right ?
2. Here if i consider “BrowserFactory ” as parent or base class , How to make use of bowser instance in other classes , Ex: From your method in Common reusable , Actual Test method in Module class(Module here mean which is project specific) ?