WebDriver???Actions????????????????
???????????? ???????[ 2015/2/12 14:02:02 ] ?????????????????? ????????????
??????????????
????1. ?????????div?????????????????14??
????2. ??????????20??
????Actions builder = new Actions(driver); //new ??Actions????
????builder.doubleClick(message).build().perform(); //????????????е??????????????build().perform()???????
package com.example.tests;
import static org.junit.Assert.*;
import org.junit.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class Selenium2 {
WebDriver driver = new FirefoxDriver();
@Test
public void tableTest() {
driver.get("D:\demo\DoubleClickDemo.html");
WebElement message = driver.findElement(By.id("message"));
// ???????????14px
assertEquals("14px"?? message.getCssValue("font-size"));
Actions builder = new Actions(driver);
builder.doubleClick(message).build().perform();
// ??????????????20px
assertEquals("20px"?? message.getCssValue("font-size"));
driver.close();
}
}
??????????????
???????dragAndDrop(source??targe)????
package com.example.tests;
import static org.junit.Assert.*;
import org.junit.*;
import org.openqa.selenium.*;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.interactions.Actions;
public class Selenium2 {
@Test
public void testDragDrop() {
WebDriver driver = new InternetExplorerDriver();
driver.get("D:\demo\DragAndDrop.html");
WebElement source = driver.findElement(By.id("draggable"));
WebElement target = driver.findElement(By.id("droppable"));
Actions builder = new Actions(driver);
builder.dragAndDrop(source?? target).perform();
try {
assertEquals("Dropped!"?? target.getText());
} catch (Error e) {
e.printStackTrace();
}finally{
driver.close();
}
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11