Pardeep
Pardeep

Reputation: 1

How to open new TAB in IE using WatiN?

How can I open a tab and go to "http://anotherwisite.com"? I tried this:

ie = new WatiN.Core.IE("https://somewebsite.com", true);
ie.TextField(WatiN.Core.Find.ByName("user")).TypeText(User.getName());
ie.TextField(WatiN.Core.Find.ByName("password")).TypeText(User.getPassword());
ie.Button(WatiN.Core.Find.Any).Click();

(the above code opens an IE and log the person in)

Upvotes: 0

Views: 2530

Answers (3)

djsolid
djsolid

Reputation: 385

System.Windows.Forms.SendKeys.SendWait("^{t}"); 
Thread.Sleep(400); 
//this is the new browser instance
var newTab = Browser.AttachTo<IE>(Find.ByTitle(string.Empty)); 

Upvotes: 0

mike_bd88
mike_bd88

Reputation: 31

I can open a new Tab and open new page with Watin

Code:

var browser1 = new FireFox("http://www.omda.com");
SendKeys.SendWait("^{t}");
browser1.GoTo("http://www.omda2.com");

I use the keyboard, CTRL+T in Firefox.

Upvotes: 3

prostynick
prostynick

Reputation: 6219

There is no built-in method in WatiN to do that.

Upvotes: 0

Related Questions