C# 如何使用WatiN在IE中打开新选项卡?
如何打开选项卡并转到“http://anotherwisite.com"? 我试过这个:C# 如何使用WatiN在IE中打开新选项卡?,c#,watin,C#,Watin,如何打开选项卡并转到“http://anotherwisite.com"? 我试过这个: 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 = 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();
(以上代码打开IE并让用户登录)WatiN中没有内置的方法来完成此操作。WatiN中没有内置的方法来完成此操作。我可以打开一个新选项卡并使用WatiN打开新页面 代码:
我在Firefox中使用键盘CTRL+T。我可以用Watin打开一个新选项卡和新页面
System.Windows.Forms.SendKeys.SendWait("^{t}");
Thread.Sleep(400);
//this is the new browser instance
var newTab = Browser.AttachTo<IE>(Find.ByTitle(string.Empty));
代码:
我在Firefox中使用键盘CTRL+T。System.Windows.Forms.SendKeys.SendWait("^{t}");
Thread.Sleep(400);
//this is the new browser instance
var newTab = Browser.AttachTo<IE>(Find.ByTitle(string.Empty));
睡眠(400);
//这是新的浏览器实例
var newTab=Browser.AttachTo(Find.ByTitle(string.Empty));
System.Windows.Forms.SendKeys.SendWait(“^{t}”);
睡眠(400);
//这是新的浏览器实例
var newTab=Browser.AttachTo(Find.ByTitle(string.Empty));