问题描述
我正在使用Perl WWW :: Mechanize制作一个webscraper.我的问题是,我要抓取的网站使用的JavaScript太多了.我正在使用凭据登录,然后使用$mech->follow_link(url)
遍历到自定义搜索.
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)
.
问题从这里开始.我登陆到一个页面,我必须从一个启用了JavaScript的下拉列表中选择一个复选框和一个单选按钮.我被困在这一点上.
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.
html的部分如下.使用$mech->tick('cs-MajorIndustryGroup')
时出现错误
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
推荐答案
WWW::Mechanize
不支持JavaScript.您可以尝试以下一些模块:
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
.
有关更多信息,请参见 WWW::Mechanize::FAQ
.
For more information see WWW::Mechanize::FAQ
.
这篇关于不能使用Perl WWW :: Mechanize勾选复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!