How to get styles of an element in AngleSharp

588 Views Asked by At

I can't figure out how i can get all computed styles of an element in AngleSharp. Here's what I've tried:

var config = Configuration.Default.WithDefaultLoader().WithCss();
var context = BrowsingContext.New(config);
var document = await context.OpenAsync("A website");
var button = document.QuerySelector("a.random class");
var styles = document.DefaultView.GetComputedStyle(button); // holds null
                

Can anyone help figure out how this is done? I found this method on their documentation but it doesn't work.

0

There are 0 best solutions below