Javascript 如何从CasperJS中的多个节点中选择一个节点?
以下是HTML:Javascript 如何从CasperJS中的多个节点中选择一个节点?,javascript,css-selectors,casperjs,Javascript,Css Selectors,Casperjs,以下是HTML: <div class="graph_tit" id="graph_tit"> <a href="/jsp/home/contents/climateData/smart/smartStatisticsSearch.do" class="on" onclick="return false;">관측자료</a> <a href="/jsp/home/contents/climateData/smart/smartStatisticsSea
<div class="graph_tit" id="graph_tit">
<a href="/jsp/home/contents/climateData/smart/smartStatisticsSearch.do" class="on" onclick="return false;">관측자료</a>
<a href="/jsp/home/contents/climateData/smart/smartStatisticsSearch.do" onclick="return false;" class="">통계자료</a>
</div>
您可以检查以下各项:
您可能还需要等待选择器:
你想选择哪一个?如果Alexe的答案对你没有帮助(而且应该是这样),那么其他地方就有问题了。请注册到
resource.error
,page.error
,remote.message
和casper.page.onResourceTimeout
事件()。可能有错误。另外,我使用waitForSelector。错误消息:“等待超时5000ms已过期,正在退出。”@ARongKwon页面上是否有iframe元素?我尝试了Chrome开发。Chrome开发工作进展顺利。但是,CasperJS不是。此页面上存在iframe。
$('div[id="graph_tit"] a[class=""]').click();
$('div[id="graph_tit"] a[text()="통계자료"]').click();
this.click('div.graph_tit a[class=""]');
this.waitForSelector('div.graph_tit a[class=""]').thenClick('div.graph_tit a[class=""]');