Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用WatiN在IE中打开新选项卡?_C#_Watin - Fatal编程技术网

C# 如何使用WatiN在IE中打开新选项卡?

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())

如何打开选项卡并转到“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.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));