2

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">
hardkoded
  • 18,915
  • 3
  • 52
  • 64
bbhxwl
  • 41
  • 6

1 Answers1

1

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

var type = await node.EvaluateFunctionAsync<string>("node => node.type");
hardkoded
  • 18,915
  • 3
  • 52
  • 64