組み込みの検索機能でウェブサイトを使用してデータを収集しようとしていますが、「検索」ボタンを押す方法がわかりません。これは、JavaScript がラップされており、ページの新しい反復ごとに ID が変化するためです。
サイトのセクションのデータは次のとおりです。
<html>
<head>
</head>
<body>
<table>
<tr>
<td>
<td>
<table>
<tr>
<td>
<!-- start of toolbar Main -->
<table>
<tr>
<td>
<table>
<tr class="buttonPad">
</tr>
<tr>
* <td nowrap="true" valign="top" class="button"><a id="S7674" accesskey="S" class="button" title="SEARCH" onclick="dispatch('S7674');"><u>S</u>></td>
</tr>
</table>
</td>
<td</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</td>
</tr>
</table>
</body>
</html>
そして私のコード
my $tree= HTML::TreeBuilder::XPath->new;
$tree->parse($url);
my @nodes = $tree->findnodes('/html/body/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td/table.buttonSpace/tbosy/tr/a.button')->get_nodelist; # line is modified later.
my $nodecount = scalar(@nodes);
if ($nodecount > 0 ) { print "we found something\n"; }
else { print "nothing found\n"; }
foreach my $node (@nodes)
{
print "node is $node\n";
my $id = $node->findvalue('button');
print "my id is $id\n";
}
悲しいことに、私のコードはノード値を返しません。
よろしくお願いします。
マイクロ