简体   繁体   中英

How can i send data into input that doesn't have name using jsoup?

I'm trying to send data into search form in a website using jsoup. but this input doesn't have a name can anyone help me the website looks like this

I tried using the form name but it doesn't work

<form name="f">
<input id="y" autocomplete="off">
....
<input>
<select id="s" style="">
<option value="a">A</option>
<option value="b">B</option>
</select>
</form>

here i want to send data to the input with the id y and get some result if the data is sent but the result is empty

It doesn't have a name probably because there's some javascript code to get the value and then send request. According to Roberto's advice it's really easily visible in browser's debugger in Network tab and you can see it's sent as a searchword parameter:

在此处输入图片说明

The next problem you're going to have is that the response comes as a JSON and you can't parse it with Jsoup. You will have to get it with .ignoreContentType(true) and then use some JSON parsing library. But there seems to be another way. Just try to GET the URL directly with a search phrase like: https://manganelo.com/search/killua_san The response already contains search results in HTML code so Jsoup will be able to parse it.

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