2
的HtmlUnit
我用Perl工作和WWW ::图书馆的HtmlUnit点击访问以下站点: https://www.cnatra.navy.mil/scheds/schedule_data.aspx?sq=VT-7如何模拟在“”链接使用Perl WWW ::
我可以加载页面,点击“查看时间表”和“搜索”按钮,但我无法点击ctrl日历中的某个编号天数。
我一直在寻找click()函数,但是我必须在调用这个函数之前定义我想要点击的链接作为一个元素。
任何想法我如何才能真正让程序找到并点击这些链接?
下面是描述链接的网站代码中,我想点击:
<td align="center" style="width:14%;">
<a href="javascript:__doPostBack('ctrlCalendar','4241')"
style="color:Black" title="August 12">12</a>
</td>
下面是简化的代码,我就会把它在:
use WWW::HtmlUnit;
use Inline::Java;
my $webClient = WWW::HtmlUnit->new;
$webClient->setUseInsecureSSL(1);
my $page = $webClient->getPage("https://www.cnatra.navy.mil/scheds
/schedule_data.aspx?sq=vt-7");
###define $daylink element here. This is the calendar link I want to click
my $sched = $daylink->click();
my $content = $sched->asXml;
print "\n$content\n\n";