QuerySelector returns null for selector
See original GitHub issueBug Report
Prerequisites
- Can you reproduce the problem in a MWE?
- Are you running the latest version of AngleSharp?
- Did you check the FAQs to see if that helps you?
- Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g.,
AngleSharp.Css
for CSS support) - Did you perform a search in the issues?
For more information, see the CONTRIBUTING
guide.
Description
We have a site with a list of datasets on it: https://trudvsem.ru/opendata/datasets
I can use a selector #dataset-10 .table__wrapper .link
to find some download url on the site.
Element exists and can be found through standard document.querySelector
APIs in JS:
Also checked this with jsoup
in Java and bs4
in python, everything works.
Howewer, in AngleSharp it simply doesn’t work at all and returns null
:
Steps to Reproduce
- Create a console project
- Install AngleSharp
- Query element with selector above
Or just simply check the demo code in my repository https://github.com/readonlyden/anglesharp-bug-demo
Expected behavior: Element is returned correctly and I can check it href
attribute
Actual behavior: QuerySelector
returns null
Environment details: .NET 6, Windows
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
The document.querySelector returns null but element exists
querySelector () will return the first element that matches the specified group of selectors. If no match is found 'null' is returned.
Read more >document.querySelector(...) is null error - javascript
It's saying it's null because the selector passed to document.querySelector() isn't returning an element/node upon which to work. Can you verify ...
Read more >document.querySelector returns null for existing element
Current behavior: Cypress cannot find an element which exists on the page and is visible. Actually, document.querySelector also does not ...
Read more >Avoid Errors With document.querySelector and ...
When querySelector doesn't find a matching selector, the value of the variable will be null . For example: var missingElement = document.
Read more >querySelector returns Null or undefined for childNodes
Hi All,. I'm trying to generate highcharts using JS script passed through client action. I have certain containers on screen (in nested ...
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
You compare two different things. See what Anglesharp received from the server. Instead of looking at postman you should look at Anglesharp.
As long as there is no MWE to reproduce there is nothing we investigate. The code right now uses an URL and when I go there I don’t see any table / get the same behavior in chrome that you describe as a bug.
So if you really think this is an issue please make a reproducible MWE. Happy to look into it when we have some code showing the issue.