I am currently struggling with retrieving the HTML inner text value using CSS selector or XPath. While I can achieve this using document.getElementById, I am unable to do so using selectors. I can only print the tag element but not the text from it.
For example:
<li class="active">
<span id="lastPrice">1,603.35</span>
<span id="CAToday"></span><br>
<span class="up" id="change">28.80</span>
</li>
In the above HTML snippet, my goal is to extract 1,603.35 using either:
CSS
XPath
Although I have searched through various forums, I have been unsuccessful in finding a solution to my problem.