【发布时间】:2015-07-04 09:53:19
【问题描述】:
我正在尝试从 HTML 页面中提取事件 - http://www.staffordshire-pcc.gov.uk/space/
我想使用 python 选择不同的区域,但遇到以下 HTML:
<select data-ng-options="key as value.name for (key,value) in areaGroups | orderBy:'name'" data-ng-model="selectedAreaGroup" data-ng-change="updateAreaGroup()" class="ng-pristine ng-valid ng-touched">
<option value="" class="" selected="selected">Choose an area</option>
<option value="string:CannockChase" label="Cannock Chase District">Cannock Chase District</option>
<option value="string:EastStaffordshire" label="East Staffordshire">East Staffordshire</option>
<option value="string:Lichfield" label="Lichfield District">Lichfield District</option>
<option value="string:Newcastle" label="Newcastle Borough">Newcastle Borough</option>
<option value="string:SouthStaffordshire" label="South Staffordshire">South Staffordshire</option>
<option value="string:Stafford" label="Stafford Borough">Stafford Borough</option>
<option value="string:StaffordshireMoorlands" label="Staffordshire Moorlands">Staffordshire Moorlands</option>
<option value="string:SoTCentral" label="Stoke-on-Trent Central">Stoke-on-Trent Central</option>
<option value="string:SoTNorth" label="Stoke-on-Trent North">Stoke-on-Trent North</option>
<option value="string:SoTSouth" label="Stoke-on-Trent South">Stoke-on-Trent South</option>
<option value="string:Tamworth" label="Tamworth Borough">Tamworth Borough</option>
我使用 Mechanize 在页面上查找表单,但由于标签没有附加表单,我无法确定如何选择它,然后提交一个值。
什么是我追求的最佳选择?
【问题讨论】:
标签: python html selenium web-scraping mechanize