You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[π Feature]: [dotnet] Road to be AOT friendlyΒ #14480
@nvborisenko, 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.
Iβm interested in this feature for running Selenium. Often times, the roads to AOT compatibility leads to improvements across the board, even for non-AOT scenarios.
Often times, the roads to AOT compatibility leads to improvements across the board, even for non-AOT scenarios.
Who knows potential issues... , I cannot prepare decomposed tasks to archive the goal. Our mission here is to adopt existing codebase to be ready for AOT.
The technical enabler is resolved, so the list of impacted areas will be be growing so fast soon.
@RenderMichael are you able to test the preview version of Selenium which seems is compatible with AOT (excepting CDP)? Your input would be valuable. I can share nuget package file here (built locally).
@nvborisenko Unfortunately the app crashed as soon as I tried running the native .exe file:
I can't give more detailed feedback without building the library locally. Are there any instructions I can follow to build the .NET bindings locally? A while back I tried to do so following this guide but ran into some blockers (I no longer remember what they were).
This was my program for the above. Completely ideomatic, no obscure Selenium features or anything.
usingOpenQA.Selenium.Firefox;varoptions=newFirefoxOptions{AcceptInsecureCertificates=true,};using(vardriver=newFirefoxDriver(options)){awaitdriver.Navigate().GoToUrlAsync("https://www.google.com");stringurl=driver.Url;if(!url.Contains("google")){thrownewException("URL does not contain google: "+url);}}Console.ReadKey();
I received a lot of issues privately related to json serialization. In major cases users used custom class and they provided an instance of it as object. Object is expected according API, and they got JsonTypeInfo metadata for type '*' was not provided by TypeInfoResolver of type 'OpenQA.Selenium.CommandJsonSerializerContext' exception. @RenderMichael provided elegant fix (will be in 4.27). Seems we will forget about this issue for "classic" WebDriver commands. Thank you, Michael, great job!
My current goal is to migrate my selenium project into a Native Aot application.
I get errors when i start a new DevToolsSessions
OpenQA.Selenium.WebDriverException: 'Unexpected error creating WebSocket DevTools session.'
InvalidOperationException: Reflection-based serialization has been disabled for this application. Either use the source generator APIs or explicitly configure the 'JsonSerializerOptions.TypeInfoResolver' property.
var driver = new ChromeDriver();
var devToolsSession = driver.GetDevToolsSession(); <- Error here
I am not familie with the internals of Selenium but maybe you can tell me if my project is a lost cause or if the problems are going to be handled by some of the hard work you seem to be doing in regards to AOT ?
We'll still allow access to lower level CDP functionality (see #13990), but the high level approach will be removed.
I interpret this to mean we will still keep the SendCommand method which takes a string commandName, and JsonNode commandParameters, with the JsonElement? response. Basically remove the strongly typed commands.
For that reason, we shouldn't unnecessarily block AOT, especially since supporting it is so simple: #15159
Activity
github-actions commentedon Sep 9, 2024
@nvborisenko, 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-templatelabel.If the issue is a question, add the
I-questionlabel.If the issue is valid but there is no time to troubleshoot it, consider adding the
help wantedlabel.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 answerlabel.Thank you!
nvborisenko commentedon Sep 9, 2024
Blocked by bazel-contrib/rules_dotnet#443
RenderMichael commentedon Sep 10, 2024
Iβm interested in this feature for running Selenium. Often times, the roads to AOT compatibility leads to improvements across the board, even for non-AOT scenarios.
NCLnclNCL commentedon Sep 26, 2024
when it will be fixed
nvborisenko commentedon Oct 4, 2024
Fixed, waiting release soon.
Who knows potential issues... , I cannot prepare decomposed tasks to archive the goal. Our mission here is to adopt existing codebase to be ready for AOT.
The technical enabler is resolved, so the list of impacted areas will be be growing so fast soon.
nvborisenko commentedon Oct 17, 2024
@RenderMichael are you able to test the preview version of Selenium which seems is compatible with AOT (excepting CDP)? Your input would be valuable. I can share nuget package file here (built locally).
RenderMichael commentedon Oct 17, 2024
@nvborisenko I would be happy to test out the AOT compatibility of Selenium :)
nvborisenko commentedon Oct 17, 2024
Selenium.WebDriver.4.26.0-nightly202409202352.zip
@RenderMichael This is zip, which contains nupkg inside. I built it locally, and hoping you know what to do with it.
nvborisenko commentedon Oct 18, 2024
@RenderMichael @NCLnclNCL please don't forget to share results. Thanks guys.
RenderMichael commentedon Oct 20, 2024
@nvborisenko Unfortunately the app crashed as soon as I tried running the native .exe file:I can't give more detailed feedback without building the library locally. Are there any instructions I can follow to build the .NET bindings locally? A while back I tried to do so following this guide but ran into some blockers (I no longer remember what they were).Edit: it was my error
RenderMichael commentedon Oct 20, 2024
This was my program for the above. Completely ideomatic, no obscure Selenium features or anything.
10 remaining items
nvborisenko commentedon Nov 18, 2024
I received a lot of issues privately related to json serialization. In major cases users used custom class and they provided an instance of it as
object. Object is expected according API, and they gotJsonTypeInfo metadata for type '*' was not provided by TypeInfoResolver of type 'OpenQA.Selenium.CommandJsonSerializerContext'exception. @RenderMichael provided elegant fix (will be in 4.27). Seems we will forget about this issue for "classic" WebDriver commands. Thank you, Michael, great job!RenderMichael commentedon Nov 18, 2024
Happy to contribute!
I have a PR addressing every AOT concern aside from JSON. It was a lot simpler than I thought. #14637
NCLnclNCL commentedon Nov 19, 2024
Hi,do you know anything about python, i want to convert python nodriver library to c#
larsbloch commentedon Nov 21, 2024
Hi
My current goal is to migrate my selenium project into a Native Aot application.
I get errors when i start a new DevToolsSessions
OpenQA.Selenium.WebDriverException: 'Unexpected error creating WebSocket DevTools session.'
InvalidOperationException: Reflection-based serialization has been disabled for this application. Either use the source generator APIs or explicitly configure the 'JsonSerializerOptions.TypeInfoResolver' property.
I am not familie with the internals of Selenium but maybe you can tell me if my project is a lost cause or if the problems are going to be handled by some of the hard work you seem to be doing in regards to AOT ?
nvborisenko commentedon Nov 22, 2024
GetDevToolsSessionis not compatible with AOT yet, please trackCDPsection in the original post.nvborisenko commentedon Feb 27, 2025
@RenderMichael do you want to invest into CDP (DevTools) AOT compatibility? I don't want, BiDi is a priority for me.
RenderMichael commentedon Feb 27, 2025
@nvborisenko Per the tracking issue for depreciating CDP #13994:
I interpret this to mean we will still keep the
SendCommandmethod which takes astring commandName, andJsonNode commandParameters, with theJsonElement?response. Basically remove the strongly typed commands.For that reason, we shouldn't unnecessarily block AOT, especially since supporting it is so simple: #15159
github-actions commentedon Jan 12, 2026
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 14 days.
github-actions commentedon Jan 26, 2026
This issue was closed because it has been stalled for 14 days with no activity.
flucas1 commentedon Jun 7, 2026
For my projects, I have found the flag JsonSerializerIsReflectionEnabledByDefault quite useful
Even if there are parts of the code using reflection, at lest I know the Json part is reflection free... and therefore AOT and trimming safe
nvborisenko commentedon Nov 7, 2026
TLC proposed CDP is out of scope, even if PR provided.
So this feature request will alive forever. Crossfingers we will be able to move on somehow.