TA的每日心情 | 开心 2017-7-6 15:53 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]测试小兵
|
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.firefox.bin", "D:/firefox/firefox.exe");
WebDriver mainWindow = new FirefoxDriver();
mainWindow.get("http://www.******.com");
WebElement Freemake=mainWindow.findElement(By.linkText("免费使用"));
Freemake.click();
String[]handles=new String[mainWindow.getWindowHandles().size()];
mainWindow.getWindowHandles().toArray(handles);
WebDriver childWindow=mainWindow.switchTo().window(handles[1]);
WebElement Register=childWindow.findElement(By.id("siginbtn"));
Register.click();
WebElement Merchantname=childWindow.findElement(By.id("rgOrgName"));
Merchantname.sendKeys("****123");
WebElement Username=childWindow.findElement(By.id("rgUserName"));
Username.sendKeys("FFFFFF");
WebElement Password=childWindow.findElement(By.id("rgPassWord"));
Password.sendKeys("123456");
WebElement Passwordagin=childWindow.findElement(By.id("rgPassWordAgin"));
Passwordagin.sendKeys("123456");
WebElement TelePhone=childWindow.findElement(By.id("rgTelePhone"));
TelePhone.sendKeys("13****87");
WebElement Email=childWindow.findElement(By.id("rgEmail"));
Email.sendKeys("*******@qq.com");
WebElement Submission=childWindow.findElement(By.className("loginbtn siginbtn"));
Submission.click(); // 最后提交时报错~~
提交按钮网页元素
<div class="loginbtn siginbtn" onclick="dosubmit()"> 提交 </div>
} |
|