简体   繁体   中英

How do I retrieve text from inside the html using wallaby/elixir?

I need to use the digits displayed in the HTML to make test with elixir/ wallaby.

ex:

class="app-add-installemnts-link">14903 1/3</a></td>

How can I retrieve the number: 14903 1/3

Is there a function or a way to do this?

If there's only one matching element:

find(css(".app-add-installemnts-link")
|> Element.text()

Reference

You can use Wallaby.Browser function like this:

Wallaby.Browser.text(session, css(".app-add-installemnts-link"))

More details here: https://hexdocs.pm/wallaby/Wallaby.Browser.html#text/2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM