Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggest: support selector like :scope > a #6

Open
charliefr opened this issue Jan 28, 2019 · 1 comment
Open

suggest: support selector like :scope > a #6

charliefr opened this issue Jan 28, 2019 · 1 comment

Comments

@charliefr
Copy link

environment

  • netcoreapp2.2
  • dotnet add package ScrapySharp --version 3.0.0

details

invalid selector :scope > a

example

<div id="node">
some text <a>link</a> 
<span>span</span> some text <br/>
<p><a>link</a> </p>
</div>

I want select like &>a, or #node>a,but use (HtmlNode node).CssSelect("selector")

HtmlNode node = ....
node.CssSelect(":scope > a")

same like .tit>a:nth-child(2) ,
I can use LINQ like
var link= tit.ChildNodes.Where((e, idx) => e.Name == "a" && idx == 1).FirstOrDefault()
when use the selector, if can't find the element, easy way to throw exception and include the selector > but use linq need add more messages .

thanks

ScrapySharp is simple and powerful tools, this is functional recommendation,
Thank all the participants for their great work.

@corgalore
Copy link

corgalore commented Apr 26, 2019

I would like to see support for :nth-child selectors also. Running into a problem right now where I need to use that selector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants