Skip to main content
 首页 » 编程设计

c#之Selenium中使用FireFoxDriver时,如何知道页面Url

2024年02月23日25shanyou

我正在使用 FireFoxDriver、C#、NUnit 和 Selenium。

我的测试方法首先转到一个页面并执行一些操作,然后用户将被重定向到另一个页面。

如何验证页面重定向是否发生?

this.FireFoxWebDriver.Navigate().GoToUrl(url); 
// performing some actions 
// todo: how to verify the page url now? 

谢谢,

请您参考如下方法:

啊,这么简单!

Assert.AreEqual(this.FireFoxWebDriver.Url, expectedRedirectUrl);