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 .
VDataProviderFactory is a custom class that I have written.
BrowserFactory has a static methods. You dont have to create instance of this class anywhere. All you have to do is
BrowserFactory.GetBrowser() from other classes and it will return you a webdriver instance.
Note: This class was designed by me for my framework, you will have to improvise or remove unnecessarily part based on your needs.