Watin C# - Firefox instances
I've a class with class A :
FireFox ff = new FireFox();
ff.WaitForComplete()开发者_JS百科;
class B Span targetTab = ff.Span(Find.ByText("System")); targetTab.Click();
i need to use firefox instances ff.span in class B, if i do so we have to create an new object for firefox, and which inturns open another firefox browser. is there is anyway where i can attach both the "ff"instances together so that everything runs in same broser..
thanks, Balaji S
You can pass A classes ff instance to B class constructor and use it. Here is pseudo codeL
class A
FireFox ff = new FireFox();
ff.WaitForComplete();
B BClassInstance = new B(ff);//passing firefox instance
class B
//B class constructor
public B(FireFox useThisInstance)
{
Span targetTab = useThisInstance.Span(Find.ByText("System")); //using instance created in A class
targetTab.Click();
}
精彩评论