|
虽然不知道你用的什么,给你代码参考下吧。- import java.util.concurrent.TimeUnit;
- import org.junit.*;
- import static org.junit.Assert.*;
- import org.openqa.selenium.*;
- import org.openqa.selenium.chrome.ChromeDriver;
- public class test02 {
- private WebDriver driver;
- private String baseUrl;
- @Before
- public void setUp() throws Exception {
- System.setProperty("webdriver.chrome.driver", ".\\res\\chromedriver.exe");
- driver = new ChromeDriver();
- baseUrl = "http://map.baidu.com/";
- driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
- }
- @Test
- public void testAsd() throws Exception {
- driver.get(baseUrl);
- driver.findElement(By.id("tab3")).click();
- driver.findElement(By.id("DriveSearchSta")).sendKeys("百度大厦");
- driver.findElement(By.id("DriveSearchEnd")).sendKeys("西直门");
- driver.findElement(By.id("addTPointIcon3")).click();
- driver.findElement(By.id("onway_1")).sendKeys("上地五街");
- driver.findElement(By.id("driveSearchBtn")).click();
- driver.close();
- }
- @After
- public void tearDown() throws Exception {
- driver.quit();
- }
- }
复制代码 |
|