开发者

how to identity if button submit has opened a new browser window or new tab in watin

I have the same problem, my site opens a new tab whenever I click on the submit form button. Is there any way to check whether i have opened a new tab or new windows in watin

I have tried myself with ie.internetexplorers to get the new url, it worked in some cases but in most cases it failed.

开发者_开发技巧

does any one have any better idea


Browser.AttachTo() should find you the new window:

 string expectedUrl = "http://mysite.com/expected-url/";

 using (var newWindow = Browser.AttachTo<IE>(
                  Find.ByTitle("Expected title")))
 {
       Assert.AreEqual(expectedUrl, newWindow.Url);
 }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜