问题
I am making a webscraper using perl WWW::Mechanize. My problem is the site that I am scraping is using javascript a bit too much. I am logging in using credentials, Then traversing to custom search using $mech->follow_link(url)
.
The problem starts from here. I am landing on to a page where I have to select one checkbox and one radiobutton from a javascript enabled dropdownlist. I am stuck at this point.
The part of html is as below. When I am using $mech->tick('cs-MajorIndustryGroup')
, I am getting an error
Can't call method "find_input" on an undefined value
回答1:
WWW::Mechanize
doesn't support JavaScript. You could try some of these modules:
- Gtk2::WebKit::Mechanize
- Win32::IE::Mechanize
- WWW::Mechanize::Firefox
- WWW::Scripter
- WWW::Selenium.
For more information see WWW::Mechanize::FAQ.
来源:https://stackoverflow.com/questions/12655231/cant-use-perl-wwwmechanize-to-tick-checkboxes