I am extracting name and values of each element in HTML
DOM
. For style attribute able to extract only property names not values.
My code is given below:
var elementHandles = await page.QuerySelectorAllAsync("a");
foreach (var handle in elementHandles)
{
var elementStyle = await handle.GetPropertyAsync("style");
var style = await elementStyle.JsonValueAsync();
var output = style.ToString();
}
This is my output:
{{
"0": "font-family",
"1": "font-size",
"2": "line-height",
"3": "color",
"4": "text-align"
}}
This is what I am expecting:
font-family:Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 16px;
color: #999999;
text-align: left