A Roslyn Analyzer for detecting duplicate XPath functions in the same class of the form "Locator(yourXpath);".
License
—
Deps
0
Install Size
—
Vulns
✓ 0
Published
Feb 12, 2026
$ dotnet add package XPathDuplicateAnalyzerA Roslyn Analyzer for detecting duplicate XPath functions in the same file of the form "PageDriver.RequestElement(yourXpath);".
Install the package from NuGet, clean your solution, rebuild it, and the analyzer will detect duplicate XPath functions in the same file. Note, you will have to rebuild your solution to detect new duplicates.
Warnings will show up in the format:
Code Description
XPathDuplicate FunctionName1 (line number) | FunctionName2 (line number)
This analyzer is built for C# projects using the Roslyn compiler. It uses the Roslyn API to analyze the syntax tree of your code and uses .Net Standard 2.0.
public UIElement BtnSubTreshold00() => PageDriver.RequestElement("//div[@name='uxThresholdFormat001SubmitButton']");
public UIElement TxtCurrTreshPerc00() => PageDriver.RequestElement("//input[@name='uxThresholdFormat001TextBox']");
These two lines of code are considered duplicates because they both use the same XPath "//div[@name='uxThresholdFormat001SubmitButton']".