我正在尝试在android studio中编写一个应用程序,在网站html中提交一个表单并解析结果html页面的结果。我是这类工作的新手,我需要帮助。我曾经和过去的Jsoup一起工作,但我只能连接到html和解析东西。我是新来的提交表格。以下是我想要与输入标签一起提交的HTML网站上的表格。
<form role="form" ng-submit="searchForm.$valid && searchEircode()" name="searchForm" novalidate="" class="ng-pristine ng-invalid ng-invalid-required ng-valid-minlength">
<div class="input-group">
<input placeholder="Enter a full address or Eircode" class="form-control ng-pristine ng-invalid ng-invalid-required ng-valid-minlength ng-touched" ng-class="{formcontrolRequired:searchForm.$submitted && !searchForm.$valid || InvalidEircode}" ng-model="searchQuery" name="searchQuery" required="" autocomplete="off" spellcheck="false" typeahead="address.address for address in getAutoCompleteAddresses($viewValue)" typeahead-on-select="onSelect($item, $model, $label)" typeahead-focus-first="true" focus="" ng-minlength="3" search-bar="" aria-autocomplete="list" aria-expanded="false" aria-owns="typeahead-64-7981"><ul class="dropdown-menu ng-isolate-scope ng-hide" ng-show="isOpen()" ng-style="{top: position.top+'px', left: position.left+'px'}" style="display: block;;display: block;" role="listbox" aria-hidden="true" typeahead-popup="" id="typeahead-64-7981" matches="matches" active="activeIdx" select="select(activeIdx)" query="query" position="position">
<!-- ngRepeat: match in matches track by $index -->
</ul>
<span class="input-group-btn" ng-class="{current:loading}">
<input type="submit" value="Search" class="btn btn-default btn-search-bar" ng-disabled="loading">
<div id="floatingCirclesG">
<div class="f_circleG" id="frotateG_01"> </div>
<div class="f_circleG" id="frotateG_02"> </div>
<div class="f_circleG" id="frotateG_03"> </div>
<div class="f_circleG" id="frotateG_04"> </div>
<div class="f_circleG" id="frotateG_05"> </div>
<div class="f_circleG" id="frotateG_06"> </div>
<div class="f_circleG" id="frotateG_07"> </div>
<div class="f_circleG" id="frotateG_08"> </div>
</div>
</span> </div>
<!-- ngIf: searchForm.$submitted -->
<div class="error-message ng-binding ng-hide" ng-show="InvalidEircode">
</div>
</form>
&#13;
任何前进的方式都将受到高度赞赏。
答案 0 :(得分:0)
如果您提供了网址,这会更容易。但无论如何它非常简单。只需打开浏览器的开发者工具,转到网络标签。
然后通常从浏览器提交表单,然后在网络选项卡中查看浏览器发送的请求。在标题标签中,您将能够看到已发送的所有表单数据和服务器地址。
然后你只需要用Jsoup发送完全相同的东西:)
我已经发布了一个使用Jsoup向网站提交表单(登录)的详细教程,请查看here