pythonseleniumxpathcss-selectorstextnode

Python - Getting text using selenium from text node


I'm trying to scrape some information from a website using Selenium and Python and sometimes there's texts like this HZS stonks remaining... that does not have any name or label that I can get the text by:

snapshot

I can get the mkt-card class element easily and I assume that I can somehow get it from the mkt-card element but I can't figure out how to do it.


Solution

  • As per the HTML:

    snapshot

    the desired element is within a text node and is within it's parent element <div class="mkt-card">


    Solution

    To print the text HZS stonks remaining 0.14 you can use either of the following locator strategies: