TA的每日心情 | 奋斗 2017-8-16 11:17 |
---|
签到天数: 47 天 连续签到: 1 天 [LV.5]测试团长
|
最开始是正确的,但是我把之前的工程删除后,新建的工程就一直这样,就高手指教,代码是这样的
package pers.test1;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
public class test2 {
public static void main(String[] args) {
}
private WebDriver driver;
private String baseUrl;
public void setUp() throws Exception {
System.setProperty("webdriver.gecko.driver","C:\\Program Files (x86)\\Mozilla Firefox\\geckodriver.exe");
driver = new FirefoxDriver();
baseUrl = "https://www.3c1000.com/";
}
public void qjw1() throws Exception {
driver.get(baseUrl);
driver.findElement(By.id("txtKeyword")).click();
driver.findElement(By.id("txtKeyword")).clear();
driver.findElement(By.id("txtKeyword")).sendKeys("华为mates龙钱梅");;
driver.findElement(By.id("btnSearch")).click();
driver.manage().window().maximize(); //最大浏览器化
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
}
|
|