帮对象写的自动点击页面的小脚本,如果有需要的可以试试,(#^.^#)

https://apps.fas.usda.gov/gats/ExpressQuery1.aspx

 var year = '1991';

 var box3 = document.querySelector("#ctl00_ContentPlaceHolder1_lb_Partners");
box3.value='ALLRG';
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_lb_Products");
box3.value='M1';
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlValueUnit");
box3.value='M';
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlDateSeries");
box3.value='Annual';
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlOrderBy");
box3.value='CODE';
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlInDetail");
box3.value='Product';
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlCalculation");
box3.value=''; box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlStartYear");
box3.value= year;
box3.dispatchEvent(new Event('change'));
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlEndYear");
box3.value= year;
box3.dispatchEvent(new Event('change')); function clickStep()
{
if (document.querySelector("#overlay").style.display == 'block') {
setTimeout("clickStep()", 1000);
return;
}
console.log("触发点击事件")
document.querySelector("#ctl00_ContentPlaceHolder1_btnRetrieveData").click();
}
setTimeout("clickStep()", 1000); String.prototype.startWith=function(str){
var reg=new RegExp("^"+str);
return reg.test(this);
}
var clicked = false;
function doExpand() {
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_UltraWebTab1__ctl1_grdExpressQuery_GridView1");
var rows = box3.rows;
var inputs = [];
for (var index in rows) {
var length = rows[index].cells ? rows[index].cells.length : 0;
if (length < 4) {
continue;
}
var nodes = rows[index].cells[3].childNodes;
if (nodes.length == 0) {
continue;
}
if (nodes[0].nodeName == '#text') {
continue;
}
var cell5Text = rows[index].cells[4].innerText;
if (!cell5Text.startWith('Bulk Total') && !cell5Text.startWith('Intermediate Total') && !cell5Text.startWith('Consumer Oriented Total')) {
continue;
} var input = nodes[0]; if(input.value == '-') {
continue;
} clicked = true;
input.click();
break;
}
} var index = 0;
function expandStep()
{
if (document.querySelector("#overlay").style.display == 'block' || document.querySelector("#ctl00_ContentPlaceHolder1_UltraWebTab1") == null) {
setTimeout("expandStep()", 1000);
return;
}
console.log((index++) + "打开,total:" );
doExpand();
if (!clicked) {
alert("展开完成,请下载")
return;
} else {
clicked = false;
}
expandStep();
} setTimeout("expandStep()", 5000);

United States Department of Agriculture 美国农业部网站数据自动下载小脚本的更多相关文章

  1. 163k地方门户网站系统自动审核信息脚本

    本代码实现对163k地方门户网站系统发布信息的自动审核,以及对内容中链接全过滤 软件安装 Python 安装 http://www.python.org/download/ pymssql安装 htt ...

  2. 31.网站数据监控-2(scrapy文件下载)

    温州数据采集 这里采集网站数据是下载pdf:http://wzszjw.wenzhou.gov.cn/col/col1357901/index.html(涉及的问题就是scrapy 文件的下载设置,之 ...

  3. opencart配置United States Postal Service快递

    1.安装United States Postal Service 2.登录https://registration.shippingapis.com/,注册帐号,稍后会收到邮件 3.打开邮件,记下Us ...

  4. 抓取网站数据不再是难事了,Fizzler(So Easy)全能搞定

    首先从标题说起,为啥说抓取网站数据不再难(其实抓取网站数据有一定难度),SO EASY!!!使用Fizzler全搞定,我相信大多数人或公司应该都有抓取别人网站数据的经历,比如说我们博客园每次发表完文章 ...

  5. DEDECMS网站数据备份还原教程

    备份织梦网站数据 dedecms备份教程 进入DedeCms后台 -> 系统 -> 数据库备份/还原 备份文件在\data\backupdata 下载数据库备份资料\data\backup ...

  6. 解决MS Office下载网站数据失败的问题

    最近遇到在MS Excel中建立的Web Query在创建完成后过了一段时间(或关闭文件后再次打开文件并刷新数据)出现无法刷新的问题,点击刷新时报错如下: 无法下载您要求的信息. 这是一个很不友好的报 ...

  7. 利用linux curl爬取网站数据

    看到一个看球网站的以下截图红色框数据,想爬取下来,通常爬取网站数据一般都会从java或者python爬取,但本人这两个都不会,只会shell脚本,于是硬着头皮试一下用shell爬取,方法很笨重,但旨在 ...

  8. Python_记一次网站数据定向爬取实现

    记一次网站数据定向爬取实现 by:授客 QQ:1033553122 测试环境: Python版本:Python 3.4 Win7 请勿用于商业及非法用途,仅供学习研究用,否则后果自负 数据爬取场景 如 ...

  9. 用Python下载美国国家气候数据中心(NCDC)的气候数据

    美国国家气候数据中心的官网地址是https://www.ncdc.noaa.gov/ 气候数据的下载地址是: 长格式:ftp://ftp.ncdc.noaa.gov/pub/data/noaa/,这种 ...

随机推荐

  1. postman Installation has failed: There was an error while installing the application. Check the setup log for more information and contact the author

    Error msg: Installation has failed: There was an error while installing the application. Check the s ...

  2. 64位ubuntu安装交叉编译工具链,显示找不到命令

    是因为Ubuntu64位版本已不支持ia32-libs的软件包,而是使用了lib32ncurses5.lib32z1软件包做为替代, 所以在Ubuntu16.04版本当中应该安装执行: sudo ap ...

  3. mysql 新建用户并赋予远程访问权限

    不多说直接上代码 [root@demo /]# mysql -u root -p #登录服务器数据库 Enter password:123xxx #1.创建一个新用户 testuser 密码为 tes ...

  4. 开发中,IDEA常用的快捷键

    Settings文件: Ctrl+Alt+S 搜索文件:Ctrl+Shift+N 全文搜索: Ctrl+Shift+F 全文替换: Ctrl+Shift+R 搜索内容: Ctrl+F 内容替换: Ct ...

  5. Tomcat配置实例

    转自:https://www.cnblogs.com/kismetv/p/7228274.html 目录 一.一个server.xml配置实例 二.server.xml文档的元素分类和整体结构 1.整 ...

  6. php扩展之Yar

    Yar 是一个轻量级, 高效的RPC框架, 它提供了一种简单方法来让PHP项目之间可以互相远程调用对方的本地方法. 并且Yar也提供了并行调用的能力. 可以支持同时调用多个远程服务的方法. 情况: 有 ...

  7. idea标注yml资源配置文件

  8. Promise async-await 异步解决方案

    1.简介:     async和await在干什么,async用于申明一个function是异步的,而await可以认为是async wait的简写,等待一个异步方法执行完成. 2.基本语法   在C ...

  9. C# 使用CsvHelper读取.csv文件

    1,先到包管理器下载 安装CsvHelper. 2,创建一个与csv文件字段名称相同的类 public class SurveyInfoModel { public string DIST_CD { ...

  10. Nginx从入门到实践(三)

    动静分离 动静分离是将网站静态资源(JavaScript,CSS,img等文件)与后台应用分开部署,提高用户访问静态代码的速度,降低对后台应用访问. 动静分离的一种做法是将静态资源部署在nginx上, ...