WebDriver????θ???????y???
???????????? ???????[ 2015/3/27 14:58:57 ] ????????WebDriver ?????????? ???????
	????????????????У????????????????????????y?????selenium1.0?????????????y?????????
	??????????2.0?в???иe???????????????????????click???????????y??????????link???????button??????click??????????????????????????????????
	?????????????????????????????????????????y??????????????????????????????????????????esc??????????????????????????????????ó?????
	????????????????????????????????ù???????????£?
	import java.awt.AWTException;
	import java.awt.Robot;
	import java.awt.event.KeyEvent;
	import org.openqa.selenium.By;
	import org.openqa.selenium.WebDriver;
	import org.openqa.selenium.WebElement;
	import org.openqa.selenium.firefox.FirefoxDriver;
	import org.openqa.selenium.firefox.FirefoxProfile;
	import org.openqa.selenium.interactions.Actions;
	import org.openqa.selenium.remote.DesiredCapabilities;
	import org.testng.annotations.AfterMethod;
	import org.testng.annotations.BeforeMethod;
	import org.testng.annotations.Test;
	public class TestActive {
	WebDriver driver = null;
	Actions action = null;
	Robot robot = null;
	@BeforeMethod
	public void setUp(){
	try {
	robot = new Robot();
	} catch (AWTException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
	}
	System.setProperty(“webdriver.firefox.bin”?? “D:/Firefox/firefox.exe”);
	FirefoxProfile file = new FirefoxProfile();
	DesiredCapabilities ds = DesiredCapabilities.firefox();
	ds.setCapability(FirefoxDriver.PROFILE?? file);
	driver = new FirefoxDriver(ds);
	action = new Actions(driver);
	}
	@AfterMethod
	public void tearDown(){
	}
	@Test
	public void start(){
	driver.get(“http://www.baidu.com”);
	driver.manage().window().maximize();
	//????????????y???????
	WebElement button = driver.findElement(By.xpath(“//*[@id='nv']/a[5]“));
	//????????????????
	action.contextClick(button).perform();
	//??ESC??????????y?????
	robot.keyPress(KeyEvent.VK_ESCAPE);
	}
	}
??????
					
					???·???
App??С????H5?????????????????Щ??
2024/9/11 15:34:34?????????????????????????
2024/9/10 11:13:49P-One ???????????????????????????????????????
2024/9/10 10:14:12???????????????????????????
2024/9/9 18:04:26??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44
					
			
								
								
								
								
								
								
								
								
								
								
				
sales@spasvo.com