0

there's this website that conjugates korean verbs https://www.verbix.com/languages/korean. What i wanna do is type something in the input and then get the text of the suggestion that appears. enter image description here

That blue part is the 'a' element's text enter image description here

This is my code:

app.get("/conjugation", (req, res) => {
  axios("https://www.verbix.com/languages/korean")
    .then((response) => {
      const htmlData = response.data;
      const $ = cheerio.load(htmlData);
      //Input Element
      const input = $("#auto-complete-edit");
      //Pass the value to it
      input.attr("value", "먹어요");
      //Get the selected element
      const select = $(".selected");
      select
        .map((i, child) => {
          //Get the 'a' element inner text
          return $(child).find("a").text();
        })
        .get();
      console.log(select);
    })
    .catch((err) => console.log(err));
});

And the console shows this

LoadedCheerio {
  length: 0,
  options: { xml: false, decodeEntities: true },
  _root: <ref *1> LoadedCheerio {
    '0': Document {
      parent: null,
      prev: null,
      next: null,
      startIndex: null,
      endIndex: null,
      children: [Array],
      type: 'root',
      'x-mode': 'no-quirks'
    },
    length: 1,
    options: { xml: false, decodeEntities: true },
    _root: [Circular *1]
  },
  prevObject: <ref *2> LoadedCheerio {
    '0': Document {
      parent: null,
      prev: null,
      next: null,
      startIndex: null,
      endIndex: null,
      children: [Array],
      type: 'root',
      'x-mode': 'no-quirks'
    },
    length: 1,
    options: { xml: false, decodeEntities: true },
    _root: [Circular *2]
  }
}
José Carlos
  • 626
  • 3
  • 23
  • Does this answer your question? [How to fix '$(...).click is not a function' in Node/Cheerio](https://stackoverflow.com/questions/56675374/how-to-fix-click-is-not-a-function-in-node-cheerio) – ggorlen Jan 04 '23 at 19:25
  • Cheerio can't interact with the page or perform form submissions or execute JS. See [How can I scrape pages with dynamic content using node.js?](https://stackoverflow.com/questions/28739098/how-can-i-scrape-pages-with-dynamic-content-using-node-js) – ggorlen Jan 04 '23 at 19:26

0 Answers0