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

PageTests don't seem to work #27

Open
VoidMonk opened this issue Jul 18, 2016 · 5 comments
Open

PageTests don't seem to work #27

VoidMonk opened this issue Jul 18, 2016 · 5 comments

Comments

@VoidMonk
Copy link

Hi, I copied the two tests from PageTests.cs to a standalone executable for testing purposes, but query selector returns no results for some strange reason.

async static void RunScriptSelectorTest()
{
    var url = "http://html5test.com"; // same URL as in the test
    var sel = "#score > .pointsPanel > h2 > strong"; // same valid selector path as in the test
    var config = Configuration.Default
                .WithCss()
                .WithJavaScript()
                .WithDefaultLoader(setup => setup.IsResourceLoadingEnabled = true);
    var document = await BrowsingContext.New(config).OpenAsync(url);
    var elements = document.QuerySelectorAll(sel);
    // but no results (elements.Length is zero),
    // even though given selector has one match
}

Any ideas on what might be going wrong, as compared to the passing tests?

@FlorianRappl
Copy link
Contributor

Yes, the JavaScript part is not executing correctly. However, the exact reason is unknown. I doubt its something language specific, rather some part of the DOM model is missing.

If you would find out what the exact problem is that would be super awesome. But be aware that debugging this will be quite hard, as with most other JS part.

You'll basically need to open up the JavaScript files used by HTML5Test and add parts one-by-one (first in larger blocks, then in smaller chunks to drill down). I've done it a couple of times for jQuery (e.g., previously jQuery 2.x worked fine while jQuery 1.x didn't - it turned out that jQuery 1.x needed CSS to be loaded) and it always was quite a pain.

@FlorianRappl
Copy link
Contributor

Currently identified (i.e., potential) sources of the problem: #7, #12, #15, #21 #26.

@VoidMonk
Copy link
Author

Tried a few simpler local test pages with inline as well as external JS, and it seems to work in most cases, so it looks like the issue occurs with larger, more complex JS parsing and/or execution (by Jint maybe?).

I'll try to look into it further.

@FlorianRappl
Copy link
Contributor

Well, I trust Jint so far that (since Sebastion also included a lot of ES5 official tests) I would rather see the problem in AngleSharp / AngleSharp.Scripting. After all the DOM is not complete (e.g., we have no renderer), where complete means: in the state where browsers use it. If a (JS) library author assumes he is working against "the browser" it may easily come to a conflict.

Yes, in small snippets this is usually no problem, but the larger chunks where lots of things happen are not as stable as I wish they would be.

I am currently finishing some other projects to get some more spare time such that I can come back to AngleSharp Scripting. I will try to implement #7 soon.

@FlorianRappl
Copy link
Contributor

(I doubt that #7 will fix this issue, but its required sooner or later anyway; so any help from you on this issue would be greatly appreciated!)

@FlorianRappl FlorianRappl modified the milestones: v0.7, v0.6 Jan 5, 2019
@FlorianRappl FlorianRappl modified the milestones: v0.12, v1.0, v0.13 May 13, 2019
@FlorianRappl FlorianRappl modified the milestones: v0.13, v1.0 Jun 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants