Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //..
- // Specify the inner text
- string targetInnerText = "Example Text";
- // Query for the element with the specified inner text
- var targetElement = document.QuerySelector($"*:contains('{targetInnerText}')");
- // Checking if the element was found
- if (targetElement != null)
- {
- var elementText = targetElement.TextContent ?? "Not available";
- Console.WriteLine(elementText);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement