0

How do I get the HTML tag of a Locator?

With the following HTML element:

<textarea id="AnySpecialInstructions" name="AnySpecialInstructions" class="form-control"></textarea>

If I get it by the locator of

var locator = Page.Locator("id=AnySpecialInstructions");

How would would you get the HTML tag of textarea?

Greg Finzer
  • 6,714
  • 21
  • 80
  • 125

1 Answers1

0

Assuming you want to get textarea into your variable locator, you can do this:

var locator = await page.EvaluateAsync<string>("document.querySelector('#AnySpecialInstructions').tagName")
Alapan Das
  • 17,144
  • 3
  • 29
  • 52