都没有类fromDate。一个有name='fromDate',所以要检索你需要拨打doc.getElementsByAttributeValue("name", "fromDate")。更多关于上https://jsoup.org/apidocs/index.html?org/jsoup/nodes/Element.html

没有与fromDate类,<tr>,也不在你的HTML代码<td>没有元素,但你尝试在你的代码上进行遍历。由于所选元素列表为空,因此for循环无法启动,因此没有任何内容写入输出CSV文件。

如果您想选择像<input name="fromDate" ...>元素,你可以使用attribute selector

Elements inputs = doc.select("input[name=fromDate]"); 

而且你可以得到<input>attr(String) method值:

String value = inputs.get(0).attr("value"); 

相关推荐