Selenium学习14--KeyBoardUtil
来源:互联网 发布:怎么虚拟mac地址 编辑:程序博客网 时间:2024/06/05 07:21
封装键盘操作的工具类
public class KeyBoardUtil{ //press Tab key public static void pressTabKey(){ Robot robot = null; try{ robot = new Robot(); }catch(Exception e){ e.printStackTrace(); } robot.KeyPress(KeyEvent.VK_TAB); robot.KeyRelease(KeyEvent.VK_TAB); } //press Enter key public static void pressEnterKey(){ Robot robot = null; try{ robot = new Robot(); }catch(Exception e){ e.printStackTrace(); } robot.KeyPress(KeyEvent.VK_ENTER); robot.KeyRelease(KeyEvent.VK_ENTER); } //将字符串设为剪切板内容,执行黏贴操作 public static void setAndCtrlVClicpboardData(String string){ StringSelection stringSelection = new StringSeleection(string); ToolKit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection,null); Robot robot = null; try{ robot = new Robot(); }catch(Exception e){ e.printStackTrace(); } robot.KeyPress(KeyEvent.VK_CONTROL); robot.KeyPress(KeyEvent.VK_V); robot.KeyRelease(KeyEvent.VK_CONTROL); robot.KeyRelease(KeyEvent.VK_V); }}
0 0
- Selenium学习14--KeyBoardUtil
- KeyboardUtil
- selenium学习
- selenium学习
- Selenium学习-selenium RC简介
- Android工具类系列-KeyBoardUtil
- Selenium 学习笔记 - 1
- Selenium学习笔记
- Selenium学习笔记1
- Selenium学习笔记2
- Selenium学习笔记3
- Selenium学习笔记4
- Selenium学习笔记5
- Selenium Start--学习笔记
- 开始selenium学习
- Selenium学习笔记之一
- selenium学习2
- selenium学习笔记
- CSS动画中的Animation和Transition全属性实例
- 可持久化二项堆
- ]Vi/Vim查找替换使用方法
- Rxjava简单操作字符学习
- ffmpeg基本用法
- Selenium学习14--KeyBoardUtil
- Eclipse配置PyDev插件
- linux 命令
- svn E1750002
- CentOS 7安装zabbix3.0(监控本机)
- 关于与运算和取余之间的关系
- atlassian-jira-confluence-bitbucket破解
- php判断变量是否是整数的两种方法
- web.xml配置详解