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 .

Add Comment
5 Answers

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.

Virender

Professor Answered on June 3, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.