Skip to content

How to parse subElements from a given element  #71

@mjmon

Description

@mjmon

Hello and good day
I have the this webpage below on image.
I'm using web_scraper: ^0.1.4

Screen Shot 2022-01-15 at 3 52 05 PM

This is how I scrape,

    final webScraper = WebScraper('http://fightnights.com');
    if (await webScraper.loadWebPage('/upcoming-boxing-schedule')) {
      final List<Map<String, dynamic>> elements = webScraper.getElement(
        "div.container > div.row > div.col-md-8.main-col > div.unicard > ul.event-list > li",
        [],
      );

      for (final Map<String, dynamic> element in elements) {
        // get the time
        final time = element.getElementTitle("time.visible-xs > span.day");
        //get info
        final eventName = element.getElementTitle("div.info > h2.title");
      }
    }

from a given elements I want again to get the sub elements, how do I do it.
I was thinking something like this, obviously this one is wrong syntax but I want to get the sub elements from the initial result of elements

        // get the time
        final time = element.getElementTitle("time.visible-xs > span.day");
        //get info
        final eventName = element.getElementTitle("div.info > h2.title");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions