How does puppeter sharp get the value of an attribute?

1.2k Views Asked by At

How does puppeter sharp get the value of an attribute?It seems that getting properties and controls is not as convenient as Windows Forms WebBrowser。 In the following code, I can't get the value of type

var node=await  page.QuerySelectorAsync("#uid" );
var vv=await node.GetPropertyAsync("type");

html

<input name="uid" type="text" style="height:50px;font-size:20px;" onkeypress="txtEnter(this,event)" class="form-control" id="uid">
1

There are 1 best solutions below

1
On BEST ANSWER

I think EvaluateFunctionAsync is the most straight forward way to do this:

var type = await node.EvaluateFunctionAsync<string>("node => node.type");