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

Problem in the nth-child of even indexes #44

Open
wpsouto opened this issue Apr 22, 2021 · 3 comments
Open

Problem in the nth-child of even indexes #44

wpsouto opened this issue Apr 22, 2021 · 3 comments

Comments

@wpsouto
Copy link

wpsouto commented Apr 22, 2021

All even indexes are not found in the method below

  Future<void> loadPage() async {
     webScraper = WebScraper();
    if (await webScraper.loadFullURL('https://www.agricultura.go.gov.br/noticias.html')) {
      try {                                        
        var elements1_ok = webScraper.getElementTitle('div.g-grid.item:nth-child(1) > div > a > h2.heading');
        elements1_ok.forEach((img) => print(img));

        var elements2_notFound = webScraper.getElementTitle('div.g-grid.item:nth-child(2) > div > a > h2.heading');
        elements2_notFound.forEach((img) => print(img));

        var elements3_ok = webScraper.getElementTitle('div.g-grid.item:nth-child(3) > div > a > h2.heading');
        elements3_ok.forEach((img) => print(img));

        var elements4_notFound = webScraper.getElementTitle('div.g-grid.item:nth-child(4) > div > a > h2.heading');
        elements4_notFound.forEach((img) => print(img));

      } catch (e) {
        print(e);
      }
    }
  }

Details:
nth-child (2) returns the empty value
nth-child (3) returns the value nth-child (2)
The same is happening for all elements of the list

@Laestry
Copy link

Laestry commented Jul 30, 2021

I have the same problem

@Laestry
Copy link

Laestry commented Jul 30, 2021

it seems to be a problem with dom.dart we forked and used universal html and it worked!

@tusharojha
Copy link
Owner

Hi @Laestry!
Would you like to contribute for the same?

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

3 participants