Stub Gen Selenium Tests

This commit is contained in:
6d486f49
2026-05-19 13:36:29 -04:00
parent 5132fd8ca2
commit e86cd5c9c8
11 changed files with 274 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
using System.Linq;
using OpenQA.Selenium;
namespace AOW4.SeleniumTests.Pages;
public class NavMenuPage
{
private readonly IWebDriver _driver;
public NavMenuPage(IWebDriver driver)
{
_driver = driver;
}
public void ClickLinkByText(string linkText)
{
var link = _driver.FindElements(By.CssSelector("a[href]"))
.FirstOrDefault(e => !string.IsNullOrWhiteSpace(e.Text) && e.Text.Trim().Equals(linkText, System.StringComparison.OrdinalIgnoreCase));
if (link == null)
{
throw new NoSuchElementException($"Link with text '{linkText}' not found in the page.");
}
link.Click();
}
}