<!--test.html-->
<html>
<head>
<title>Set Timeout</title>
<script>
</script>
</head>
<body>
  <input type="text" name="lastname">
  <input id = "alert" value = "alert" type = "button" onclick = "alert('欢迎!请按确认继续!');"/>
  <input id = "confirm" value = "confirm" type = "button" onclick = "confirm('确定吗?');"/>
  <input id = "prompt" value = "prompt" type = "button" onclick = "var name = prompt('请输入你的名字:','请输入你的名字'); document.write(name) "/>
</body>
</html>
public static void main(String[] args) throws InterruptedException, IOException {
//定义一个前缀文件夹
String string="非常有才华,有能力,有技术!!!!!!!";
int i=0;
WebDriver dr = new FirefoxDriver();
String url = "file:///C:/Users/leixiaojiang/Desktop/test.html";
dr.get(url); //新建一个action
Actions action=new Actions(dr);
//操作
WebElement element=dr.findElement(By.name("lastname"));
WebElement element1=dr.findElement(By.id("alert"));
while (i<10000)
{
action.sendKeys(element,string+i).perform();
i++;
} action.moveToElement(element1);
action.click().perform();
}
//拖放的组合操作
Action dragAndDrop = builder.clickAndHold(someElement).moveToElement(otherElement).release(otherElement).build().perform();
其他鼠标或键盘操作方法可以具体看一下API 里面的
org.openqa.selenium.interactions.Actions 类

selenium 使用action进行鼠标,键盘操作的更多相关文章

  1. Java+selenium之WebDriver模拟鼠标键盘操作(六)

    org.openqa.selenium.interactions.Actions类,主要定义了一些模拟用户的鼠标mouse,键盘keyboard操作.对于这些操作,使用 perform()方法进行执行 ...

  2. selenium之 玩转鼠标键盘操作(ActionChains)

    用selenium做自动化,有时候会遇到需要模拟鼠标操作才能进行的情况,比如单击.双击.点击鼠标右键.拖拽等等.而selenium给我们提供了一个类来处理这类事件——ActionChains sele ...

  3. selenium webdriver(4)---模拟鼠标键盘操作

    webdriver提供Actions来模拟鼠标悬浮.拖拽和键盘输入等操作,详细代码见org.openqa.selenium.interactions.Actions.本文通过几个实例来说明Action ...

  4. selenium层级定位及鼠标键盘操作

    #code:utf-8 from selenium import webdriver from selenium.webdriver.common.action_chains import Actio ...

  5. selenium 鼠标,键盘操作

    1.打开和关闭网页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #!/usr/bin/env python # -*- coding:u ...

  6. selenium模拟鼠标键盘操作

    简单操作: 1.点击(鼠标左键)页面按钮:click() 2.清空输入框:clear() 3.输入字符串:send_keys()submit提交表单: 1.一般情况可以点击搜索按钮来搜索 2.也可以用 ...

  7. selenium webdriver从安装到使用(python语言),显示等待和隐性等待用法,切换窗口或者frame,弹框处理,下拉菜单处理,模拟鼠标键盘操作等

    selenium的用法 selenium2.0主要包含selenium IDE 和selenium webDriver,IDE有点类似QTP和LoadRunner的录制功能,就是firefox浏览器的 ...

  8. selenuim2模拟鼠标键盘操作

    有时候有些元素不便点击或者做其他的操作,这个时候可以借助selenium提供的Actions类,它可以模拟鼠标和键盘的一些操作,比如点击鼠标右键,左键,移动鼠标等操作.对于这些操作,使用perform ...

  9. python模拟鼠标键盘操作 GhostMouse tinytask 调用外部脚本或程序 autopy右键另存为

    0.关键实现:程序窗口前置 python 通过js控制滚动条拉取全文 通过psutil获取pid窗口句柄,通过win32gui使程序窗口前置 通过pyauto实现右键菜单和另存为操作 1.参考 aut ...

随机推荐

  1. 我厂 WiFi SDK 开源了, 直接开源 WiFi 万能钥匙核心功能,造福中小开发者

    官方地址: http://global.18wifibank.com/ github: https://github.com/yibawifi/wifisdk

  2. Android Support 包知识

    Android Support Library包是一组代码库, 它提供了向后版本的framework API的兼容, 这些代码库实现的效果和只能在指定版本中使用的API一样好. 每个Support L ...

  3. 【原】HTTP in iOS你看我就够

    声明:本文是本人 编程小翁 原创,转载请注明. 本文同步发布在简书中,强烈建议移步简书查看,编程小翁 HTTP属于老话题了,在项目中我们经常需要往服务端发POST或者GET请求,但是对于HTTP的了解 ...

  4. 实用的圆形图片控件ImageView

    1.用法直接在布局中引用即可 import android.content.Context;import android.content.res.TypedArray;import android.g ...

  5. order by 与 group by 区别

    order by 排序查询.asc升序.desc降序 示例: select * from 学生表 order by 年龄 ---查询学生表信息.按年龄的升序(默认.可缺省.从低到高)排列显示 也可以多 ...

  6. 解决ie6下li左浮动文字换行的问题

    问题: 使用li左浮动来自动换行,当父标签剩下宽度不够一个li的宽度时,在ie6中最后一个li中的文字出现换行 解决办法: ul{ white-space:nowrap;} /*强制文字不换行*/

  7. (七)Transformation和action详解-Java&Python版Spark

    Transformation和action详解 视频教程: 1.优酷 2.YouTube 什么是算子 算子是RDD中定义的函数,可以对RDD中的数据进行转换和操作. 算子分类: 具体: 1.Value ...

  8. (转载)centos yum源的配置和使用

    原文地址:http://www.cnblogs.com/mchina/archive/2013/01/04/2842275.html 一.yum 简介 yum,是Yellow dog Updater, ...

  9. Holographic Remoting Player

    https://developer.microsoft.com/en-us/windows/holographic/holographic_remoting_player http://www.cnb ...

  10. 有关日期的函数操作用法总结,to_date(),trunc(),add_months();

    相关知识链接: Oracle trunc()函数的用法 oracle add_months函数 Oracle日期格式转换,tochar(),todate() №2:取得当前日期是一个星期中的第几天,注 ...