I am writing a Java application which tries to fetch contents from a web page. I try to write code which is given below.
When I try to fetch all links(html <a> tag) from the website my code works well,
but when I try to fetch a value from input type="hidden" tag I have a problem.
String url = "http://www.justdial.com/Bangalore/pc-repair-%3Cnear%3E-jp-nagaer";
Document doc = Jsoup.connect(url).get();
Elements input = doc.select("a[href]");
System.out.print(input);
This code works fine.. it gives all the links included in this website.. but I want the value from input type="hidden". What to do I have to do?
If I do doc.select("input[hidden]") then result comes with a null value.
You should use
to get the tags you want. Your proposed version will return all
<input hidden="..">tags not those with<input type="hidden">.