Java – how to use jsoup to get hidden input values?

I have data

<input name="authenticity_token" type="hidden" value="aiUlw1Yh4W47lPQearSEdTkU0rhKpziZOweq5PMTV0Q=" />

I tried to choose it with jsup

Element input = doc.select("input[name=authenticity_token]").first();

 String auth_token = input.attr("value");

But it doesn't work

I got string auth_ Null pointer of token = is abnormal

What on earth did I do wrong?

Solution

If you check this demo, you will find that there is no problem at all in this case and you have selected input

I believe there may be another input with the same name but no value If this is not the case, please post the problem on the jsoup GitHub page

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>