Code cleanup
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System.Linq;
|
||||
using OpenQA.Selenium;
|
||||
|
||||
namespace AOW4.SeleniumTests.Pages;
|
||||
@@ -15,13 +14,12 @@ public class NavMenuPage
|
||||
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));
|
||||
.FirstOrDefault(e =>
|
||||
!string.IsNullOrWhiteSpace(e.Text) &&
|
||||
e.Text.Trim().Equals(linkText, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (link == null)
|
||||
{
|
||||
throw new NoSuchElementException($"Link with text '{linkText}' not found in the page.");
|
||||
}
|
||||
if (link == null) throw new NoSuchElementException($"Link with text '{linkText}' not found in the page.");
|
||||
|
||||
link.Click();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user