开发者

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

开发者 https://www.devze.com 2023-04-09 10:41 出处:网络
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 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

精彩评论

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

关注公众号