Adding an answer bc I don't see the easy css selector shorthand for selecting by id: using #your_id_name
:
h %>%
html_node('#a') %>%
html_attr('value')
which outputs "123" as desired.
Same setup as the others:
require(rvest)
text <- '
'
h <- read_html(text)