Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: [dotnet] ShadowRoot element searching does not use By's method #15335

Open
RenderMichael opened this issue Feb 25, 2025 · 1 comment · May be fixed by #15336
Open

[🐛 Bug]: [dotnet] ShadowRoot element searching does not use By's method #15335

RenderMichael opened this issue Feb 25, 2025 · 1 comment · May be fixed by #15336

Comments

@RenderMichael
Copy link
Contributor

RenderMichael commented Feb 25, 2025

What happened?

The By type has special handling in many cases for custom methods. We use it to make sure FindElements(By.Id("")) returns an empty list instead of throwing. Users can also override By.FindElementMethod and By.FindElementsMethod for custom implementations.

This has been applied to WebDriver and WebElement, but not to ShadowRoot. We can apply it there as well so By behaves consistently.

How can we reproduce the issue?

driver.Url = shadowRootPage;
IWebElement element = driver.FindElement(By.CssSelector("custom-checkbox-element"));
ISearchContext shadowRoot = element.GetShadowRoot();
Assert.That(shadowRoot.FindElements(By.Id("")), Is.Empty);

Relevant log output

N/A

Operating System

N/A

Selenium version

4.29

What are the browser(s) and version(s) where you see this issue?

N/A

What are the browser driver(s) and version(s) where you see this issue?

N/A

Are you using Selenium Grid?

No response

Copy link

@RenderMichael, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@RenderMichael RenderMichael linked a pull request Feb 25, 2025 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant