开发者

Watin C# - Firefox instances

开发者 https://www.devze.com 2023-03-30 04:46 出处:网络
I\'ve a class with class A : FireFox ff = new FireFox(); ff.WaitForComplete()开发者_JS百科; class B

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();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消