【发布时间】:2016-01-02 03:53:47
【问题描述】:
<td>
Search Downloadable Full Charts by Date:
<br>
<select name="raceDate">
<option value="20150821">August 21</option>
<option value'"20150822">August 22</option>
...these options continue until yesterday(the default)
...
<option selected="" value="20151004">October 4</option>
</select>
<input type="submit" onclick="setSearch('D');" value="Search">
使用 RSelenium 可以:
webElem <- remDr$findElement(using = 'xpath',
"/html/body/div/div[4]/div[1]/center/
table/tbody/tr/td/form/table/tbody/tr/td/input")
webElem$clickElement()
但是使用 casperjs 我会收到 xpath 不存在的错误消息,即使我使用 css 选择器:
casper.then(function(){
this.clickLabel('.interior-content.col-sm-8>center>table>tbody>tr>td>form>table>tbody>tr>td>input');
});
casper.then(function(){
console.log('clicked search default search ok, new location is ' + this.getCurrentUrl());
});
dave@dbox:~$ casperjs --version
1.1.0-beta3
dave@dbox:~$ phantomjs --version
1.9.2
Linux dbox 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) x86_64 GNU/Linux
我还尝试了堆栈以及 CasperJS 文档中的许多其他示例。
【问题讨论】:
-
按日期搜索可下载的完整图表:
标签: javascript css-selectors click casperjs