Then your XPath query did not return anything.
Please post a short, self-contained program that reproduces the problem. That will help us reproduce the problem and maybe find a solution.
Looking at the HTML of that link you posted, why don't you use the class of the target element?
is the XPath query, not xpath.$mech->selector('.tableSearchResults')?</p> <p>Also note that the first argument to <c>->xpathEx
After fixing that part, Firefox complains that your XPath query is invalid syntax. After fixing that, your XPath query seems to go astray somewhere because no elements are found. Maybe you want to try the following small example?
use strict; use warnings; use WWW::Mechanize::Firefox; my $mech= WWW::Mechanize::Firefox->new(); $mech->get('http://jobs.scotiabank.com/search/advanced-search/ASCatego +ry/IT/ASPostedDate/-1/ASCountry/Canada/ASState/Ontario/ASCity/Toronto +/ASLocation/-1/ASCompanyName/-1/ASCustom1/-1/ASCustom2/-1/ASCustom3/- +1/ASCustom4/-1/ASCustom5/-1/ASIsRadius/false/ASCityStateZipcode/-1/AS +Distance/-1/ASLatitude/-1/ASLongitude/-1/ASDistanceType/-1'); my $id="search_result_next_page_link"; $mech->click({ xpath => qq{//*[\@id="$id"]}, synchronize => 0 }); sleep 2; my @tt= $mech->xpathEx(xpath=>'/html/body/form/div[4]/div/main/div/div +[3]/section/div/div/table/'); print 0+@tt; print $tt[0]->{innerHTML}; print "\n<--- bad API usage\n"; @tt= $mech->xpathEx('/html/body/form/div[4]/div/main/div/div[3]/sectio +n/div/div/table'); print 0+@tt; print $tt[0]->{innerHTML}; print "\n<--- fixed XPath\n"; @tt= $mech->selector('.tableSearchResults'); print 0+@tt; print $tt[0]->{innerHTML}; print "\n<--- CSS\n";
In reply to Re^3: How to get an HTML table from the document using WWW::Mechanize::Firefox ?
by Corion
in thread How to get an HTML table from the document using WWW::Mechanize::Firefox ?
by Smeet2002
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |