Creating a selector for the element
See original GitHub issueDoes AngleSharp make it able to create a selector for a certain node?
Consider this example:
<html>
<body>
<div id="header">
<span class="decorator">Logo</span>
</div>
<div id="container">
<div>
<h1>This is a test</h1>
</div>
<div>...</div>
</div>
</body>
</html>
selectedElement
points to <h1>
node in the above HTML.
When called:
selectedElement.CreateSelector();
Sample output would be the element selector:
body > div > div:nth-child(1) > h1
I have slightly browsed the source code, but wasn’t able to find anything for it. I would like be sure however, before making any efforts to implement it myself.
Regards Lucas
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
CSS Selectors
To select an element with a specific id, write a hash (#) character, followed by the id of the element. Example. The CSS...
Read more >CSS selectors - Learn web development | MDN
A CSS selector is the first part of a CSS Rule. It is a pattern of elements and other terms that tell the...
Read more >How To Select HTML Elements Using ID, Class, and ...
Creating Advanced Attribute Selectors. The attribute selector is useful for finding particular attributes in the HTML and applying styles to ...
Read more >CSS Selectors - GeeksforGeeks
A CSS selector selects the HTML element(s) for styling purposes. CSS selectors select HTML elements according to their id, class, type, ...
Read more >CSS Selector in Selenium: Locate Elements with Examples
This article will discuss and describe, with examples, how one can use CSS selectors in Selenium test scripts to identify web elements.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cmxl Since id selector is unique, it will do just what @FlorianRappl said. This is perfectly valid.
I think it stops when the first id selector is hit, e.g.,
but yes - that’s also how I see it.