SeleniuM的按键操作模拟键盘
2017-03-23 17:05
190 查看
package com.gloryroad.Demo;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class clisckSene {
String url="http://www.sogou.com";
public WebDriver driver;
@BeforeMethod
public void setUp(){
driver=new FirefoxDriver();
driver.get(url);
}
@AfterMethod
public void tearDown(){
driver.close();
}
@Test
public void clickSend() throws InterruptedException{
Actions act=new Actions(driver);
act.sendKeys(Keys.CONTROL);
act.sendKeys(Keys.SHIFT);
act.sendKeys(Keys.ALT);
act.sendKeys(Keys.CONTROL);
act.sendKeys(Keys.SHIFT);
act.sendKeys(Keys.ALT);
act.keyDown(Keys.SHIFT).sendKeys("adfba").perform();
Thread.sleep(5000);
}
}
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class clisckSene {
String url="http://www.sogou.com";
public WebDriver driver;
@BeforeMethod
public void setUp(){
driver=new FirefoxDriver();
driver.get(url);
}
@AfterMethod
public void tearDown(){
driver.close();
}
@Test
public void clickSend() throws InterruptedException{
Actions act=new Actions(driver);
act.sendKeys(Keys.CONTROL);
act.sendKeys(Keys.SHIFT);
act.sendKeys(Keys.ALT);
act.sendKeys(Keys.CONTROL);
act.sendKeys(Keys.SHIFT);
act.sendKeys(Keys.ALT);
act.keyDown(Keys.SHIFT).sendKeys("adfba").perform();
Thread.sleep(5000);
}
}
相关文章推荐
- selenium webdriver学习(十三)------------如何利用Actions类模拟鼠标和键盘的操作
- selenium webdriver 模拟键盘操作
- selenium webdriver(4)---模拟鼠标键盘操作
- Python + Selenium + AutoIt 模拟键盘实现另存为、上传、下载操作详解
- python + selenium webdriver 通过python来模拟鼠标、键盘操作,来解决SWFFileUpload调用系统底层弹出框无法定位问题
- selenium webdriver模拟鼠标键盘操作
- selenium webdriver 模拟鼠标键盘的操作
- selenium webdriver模拟鼠标键盘操作
- UI自动化测试(四)AutoIT工具使用和robot对象模拟键盘按键操作
- c++使用sendinput函数实现模拟键盘按键操作
- UI自动化测试(四)AutoIT工具使用和robot对象模拟键盘按键操作
- selenium中键盘模拟操作
- selenium 键盘模拟操作
- 用Python+Selenium模拟键盘和鼠标操作,实现自动签到
- selenium webdriver学习(十三)------------如何利用Actions类模拟鼠标和键盘的操作
- 【Demo 0105】模拟键盘按键操作
- selenium webdriver学习(十三)------------如何利用Actions类模拟鼠标和键盘的操作
- 用应用程序模拟键盘和鼠标按键
- 模拟键盘按键
- vc模拟鼠标键盘操作实用类