您的位置:軟件測試 > 開源軟件測試 > 開源功能測試工具 > Selenium
selenium web自動化初探試
作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時間:[ 2013/12/31 8:59:45 ] 推薦標(biāo)簽:Selenium Web測試

  @Test

  public void testTom() throws Exception {

    driver.get(baseUrl + "/webmail/login/index.action");

    Thread.sleep(2000);

    //tom mail login

    driver.findElement(By.id("username")).clear();

    driver.findElement(By.id("username")).sendKeys("username");

    Thread.sleep(2000);

    driver.findElement(By.id("password3_$loginhash")).clear();

    driver.findElement(By.id("password")).sendKeys(" password");   

    Thread.sleep(2000);

    driver.findElement(By.cssSelector("#login > img")).click();

    Thread.sleep(2000);

    driver.findElement(By.xpath("//ul[@id='ulTabs']/li[3]/span")).click();

    driver.findElement(By.id("pop_close")).click();

    //send mail to xxxxx@tom.com

    driver.findElement(By.id("webmail_sys_write")).click();

    driver.findElement(By.id("tob")).click();

    driver.findElement(By.id("tob")).clear();

    driver.findElement(By.id("tob")).sendKeys("xxxx@tom.com");

    driver.findElement(By.id("subject")).clear();

    driver.findElement(By.id("subject")).sendKeys("zhuti");   

    //send mail content

    WebElement cont = driver.switchTo().frame(driver.findElement(By.id("xhEdt0_iframe"))).findElement(By.className("editMode"));

    cont.sendKeys("郵件的內(nèi)容!!!");      

    driver.switchTo().defaultContent();

    driver.findElement(By.cssSelector("span[name="sendMail"]")).click();

    driver.findElement(By.id("logout")).click();

    driver.findElement(By.xpath("//button[@type='button']")).click();

    driver.findElement(By.xpath("//button[@type='button']")).click();

  }


  @After

  public void tearDown() throws Exception {

    driver.quit();

    String verificationErrorString = verificationErrors.toString();

    if (!"".equals(verificationErrorString)) {

      fail(verificationErrorString);

    }

  }

上一頁123下一頁
軟件測試工具 | 聯(lián)系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd