DHP(关于alert 处理)
TAG:
- 引用 删除 dian106106 / 2012-05-15 20:24:52
-
常用键:
robot = new Robot();
robot.keyPress(KeyEvent.VK_UP);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_UP);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_TAB);
robot.delay(1000);
robot.keyRelease(KeyEvent.VK_TAB);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_ENTER);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_SPACE);
robot.delay(1000);
robot.mouseMove(200, 50);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
- 引用 删除 dian106106 / 2012-05-15 16:47:20
-
将alert转成popup:
package ENSG;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.annotations.*;
public class NewTest {
@Test(groups = { "funtest","area1","dhp"})
@Parameters({"baseurl"})
public void dhp () {
WebDriver driver = new InternetExplorerDriver();
String overrideShowModalDialogJs="if(driver.browserbot.getCurrentWindow().showModalDialog){";
overrideShowModalDialogJs += "driver.browserbot.getCurrentWindow().showModalDialog = function( sURL, vArguments, sFeatures)";
overrideShowModalDialogJs +="driver.browserbot.getCurrentWindow().open(sURL, 'modal', sFeatures);";
overrideShowModalDialogJs += "};}";
//showModalDialog方法进行覆盖
//selenium.getEval(overrideShowModalDialogJs);
String baseurl = "http://xin.msn.com/?lang=en-sg";
driver.get(baseurl);
driver.findElement(By.linkText("Make xinmsn my homepage")).click();
//selenium.openWindow("","modal");
//selenium.waitForPopUp("modal","15000");
//selenium.selectWindow("name=modal");
for(String handle:driver.getWindowHandles()){
driver.switchTo().window(handle);
}
}
}
- 引用 删除 dian106106 / 2012-05-15 16:03:24
-
Robot robot;
try
{
robot = new Robot();
robot.keyPress(KeyEvent.VK_UP);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_UP);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_TAB);
robot.delay(1000);
robot.keyRelease(KeyEvent.VK_TAB);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_ENTER);
} catch (AWTException e)
{
e.printStackTrace();
}
标题搜索
日历
|
|||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
1 | 2 | 3 | 4 | ||||||
5 | 6 | 7 | 8 | 9 | 10 | 11 | |||
12 | 13 | 14 | 15 | 16 | 17 | 18 | |||
19 | 20 | 21 | 22 | 23 | 24 | 25 | |||
26 | 27 | 28 | 29 | 30 | 31 |
我的存档
数据统计
- 访问量: 74682
- 日志数: 80
- 建立时间: 2012-04-12
- 更新时间: 2013-05-21