针对IE安全控件的爬虫

IE安全控件

有一些数据安全级别高的网站,如银行网银,人行征信网站等,在用户登陆时会使用安全控件来加密用户的输入,有别于一般的JS加密,安全控件较难破解。

Selenium

selenium是自动化测试框架,在爬虫系统中用它来解决带有IE安全控件难于破解的问题。

下面以人行征信页面

应用1-普通文本框输入

//设置系统变量,IEDriverServer.exe需要放置到指定位置
System.setProperty("webdriver.ie.driver","C:\\Program Files (x86)\\Internet Explorer\\IEDriverServer.exe");

//初始化WebDriver
WebDriver driver = new InternetExplorerDriver();

//打开网页
driver.manage().window().maximize();
driver.get("https://ipcrs.pbccrc.org.cn/page/login/loginreg.jsp");

//输入用户名
driver.findElement(By.id("loginname")).click();
driver.findElement(By.id("loginname")).sendKeys(account);

 

应用2-有安全控件的密码输入框的输入

posted @ 2018-07-11 10:24  1031  阅读(464)  评论(0编辑  收藏  举报