I want to test if there are no broken links on the website by getting all the links in list, clicking them and getting response if they are working. Can you suggest me a way to do it in c#?
namespace billingtest
{
[TestClass]
public class test
{
FirefoxDriver driver;
[TestInitialize()]
public void SyncDriver()
{
driver = new FirefoxDriver();
driver.Manage().Window.Maximize();
}
[TestMethod]
public void testwithadmin()
{
driver.Navigate().GoToUrl("http://localhost:52982");
driver.FindElement(By.Id("UserNameOrEmail")).SendKeys("aa");
driver.FindElement(By.Id("Password")).SendKeys("aa");
driver.FindElement(By.XPath(".//*[@id='main']/form/div[3]/input")).Click();
driver.FindElement(By.XPath(".//*[@id='content-main']/div/div/a[3]")).Click();
//Get all links, click them one by one and get response if they are working
}
[TestCleanup]
public void TearDown()
{
driver.Quit();
}
}
}