import java.util.concurrent.TimeUnit;
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.remote.DesiredCapabilities;
public class MyFirstSelTest {
public static void main(String args[]){
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("http://www.gmail.com/");
WebElement un = driver.findElement(By.id("Email"));
WebElement pwd = driver.findElement(By.id("Passwd"));
WebElement submitBtn = driver.findElement(By.id("wp-signIn"));
un.sendKeys("ValidUsername");
pwd.sendKeys("ValidPassword");
submitBtn.click();
driver.quit();
}
}
Gmail 主页已打开,但未在用户名和密码字段中输入任何数据。有人可以帮助我了解我们需要为此做些什么吗?
谢谢,迈克