我正在尝试使用Watir编写可按计划运行的网络抓取工具。
我的模块称为saveBox.on("click",function () {
//e.preventDefault();
$("textarea").each(function () {
// set a variable to select the textareas attributes
var hour = $(this).attr("hour");
//console.log(hour)
//set a variable to select value of users input at certain hour
var plans = $(this).val();
//console.log(plans);
//i saved the hour's plan to local storage
localStorage.setItem(hour,plans);
//var hourInput = localStorage.getItem(hour)
});
});
,但未加载。我收到此错误:
PriceScraperModule
我的模块如下:
NameError (uninitialized constant PriceScraperModule::Watir)
我的Gemfile包括:
module PriceScraperModule
def self.scrape
browser = Watir::Browser.new
end
end
当我尝试要求它时,它也不起作用:
gem 'watir'
gem 'webdrivers'
我收到此错误:
module PriceScraperModule
require 'watir'
def self.scrape
browser = Watir::Browser.new
end
end
我该怎么办?