Where should I access the DOM elements?

You have to access the DOM elements in OnAfterRender or OnAfterRenderAsync of the Blazor component lifecycle. [JS Helper] [Razor] Have a look at the Blazor component lifecycle for more information.