-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Description
What happened?
I came across the fact that the Near relative locator for dotNet does not work.
I tried to debag, and found that I did not have the element. I get null at this point - js.ExecuteScript(wrappedAtom, parameters);
https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/RelativeBy.cs#L109
Message:β
System.NullReferenceException : Object reference not set to an instance of an object.
There are no tests for near relative locators in the dotNet project - https://github.com/SeleniumHQ/selenium/blob/b6b209602d544b769a0f4635022cf55a7b8f81b4/dotnet/test/common/RelativeLocatorTest.cs
At the same time, test coverage looks better for Java - https://github.com/SeleniumHQ/selenium/blob/trunk/java/test/org/openqa/selenium/support/locators/RelativeLocatorTest.java
How can we reproduce the issue?
I tried using the web page https://github.com/SeleniumHQ/selenium/blob/trunk/common/src/web/relative_locators.html
to test relative locators and add a test for the Near locator (By analogy with Java tests):
[Test]
public void ShouldBeAbleToFindElementsNear()
{
var elements = seleniumDriver.FindElements(RelativeBy
.WithLocator(By.TagName("td"))
.Near(By.Id("center")));
Assert.That(elements, Is.EquivalentTo(new List<string> { "second", "eighth", "fourth", "sixth", "first", "third", "seventh", "ninth" }));"seventh", "ninth");
}
the elements variable is null.
Relevant log output
Message:β
System.ArgumentException : Expected: IEnumerable But was: null (Parameter 'actual')Operating System
Windows 10
Selenium version
.Net
What are the browser(s) and version(s) where you see this issue?
Chrome
What are the browser driver(s) and version(s) where you see this issue?
chromedriverVersion, 121.0.6167.184
Are you using Selenium Grid?
No