首页 > 其他 > 详细

Selenium 模拟人输入

时间:2014-11-17 19:20:13      阅读:340      评论:0      收藏:0      [点我收藏+]

public
static void type(WebElement e,String str) throws InterruptedException { String[] singleCharacters = str.split(""); // Interval is 0.5 second between each type of character, this is to // simulate real human action for (int i = 0; i < singleCharacters.length; i++) { if (singleCharacters[i]!="") { e.sendKeys(singleCharacters[i]); Thread.sleep(500); } } Thread.sleep(1000); }

在sendKeys时,把字符串拆分成单个字符,使用间隔0.5s

Selenium 模拟人输入

原文:http://www.cnblogs.com/tobecrazy/p/4103986.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!