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

Virender ,

Do you really think its wise idea to call instance as “BrowserFactory.GetBrowser()” in long run i’mean in framework level , where your application might quite vast . I have another idea but need you help here in implementing it . Here it is

Create a base class for driver instance , then passing this instance as parameter and then in sub class methods where ever its required call  this instance as by Super(river).. this is one of implementation i had seen . Need your input in implementing it and working flow .

Train Answered on June 4, 2015.
Add Comment

Your Answer

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