I've tried using a loop with a selector to scrape the <li>, but it doesn't work.
i want to get "Program Studi Perencanaan Wilayah Dan Kota" this value and the other value
Node Cheerio code:
$('div#panel-penggiat-collapse-0 > div > div:nth-of-type(2) > div:nth-of-type(2) > span > span > span > ul > li').each((i, el) => {
console.log($(el).text())
})
HTML:
<ul class="select2-selection__rendered">
<li class="select2-selection__choice" title="Program Studi Perencanaan Wilayah Dan Kota"><span class="select2-selection__choice__remove" role="presentation">×</span>Program Studi Perencanaan Wilayah Dan Kota</li>
<li class="select2-selection__choice" title="Program Studi Matematika"><span class="select2-selection__choice__remove" role="presentation">×</span>Program Studi Matematika</li>
<li class="select2-selection__choice" title="Program Studi Fisika"><span class="select2-selection__choice__remove" role="presentation">×</span>Program Studi Fisika</li>
<li class="select2-selection__choice" title="Program Studi Statistika"><span class="select2-selection__choice__remove" role="presentation">×</span>Program Studi Statistika</li>
<li class="select2-selection__choice" title="Program Studi Sistem Informasi"><span class="select2-selection__choice__remove" role="presentation">×</span>Program Studi Sistem Informasi</li>
<li class="select2-selection__choice" title="Program Studi Desain Komunikasi Visual"><span class="select2-selection__choice__remove" role="presentation">×</span>Program Studi Desain Komunikasi Visual</li>
<li class="select2-selection__choice" title="Program Studi Teknik Komputer"><span class="select2-selection__choice__remove" role="presentation">×</span>Program Studi Teknik Komputer</li>
<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" placeholder="" style="width: 0.75em;"></li>
</ul>