您的位置:軟件測試 > 開源軟件測試 > 開源功能測試工具 > Selenium
軟件測試中的Web測試工具Selenium入門心得
作者:網(wǎng)絡轉載 發(fā)布時間:[ 2013/2/27 15:24:45 ] 推薦標簽:

  b. 以后再次加載頁面,則可以省去域名

  cmd=open&1=/cat/all?sn=0

  (打開鏈接/cat/all?sn=0)

  c. 給指定文本框輸入指定值

  cmd=type&1=q&2=bike

  (給id為q的文本框輸入值bike)

  (2)多窗口模式,可以在后臺寫java的test case,讓程序自動執(zhí)行一整套操作。

  例:

  public void testRegister() throws Exception {

    selenium.setSpeed("1000");

    selenium.open("http://zhidao.baidu.com");

    selenium.type("ikword", "abc");

    selenium.close();

  }

  2、在項目中導入selenium-java-client-driver.jar、selenium-java-client-driver-sources.jar、selenium-java-client-driver-tests.jar三個包

  3、Test Case寫法,可以繼承com.thoughtworks.selenium.TestCase類,也可以繼承 com.thoughtworks.selenium.SeleneseTestCase(它是TestCase的子類,對setUp()方法做了重寫,更為方便)

  寫法跟JUnit測試相似,需要寫一個setUp()方法,在此方法中可以對selenium對象實例化以并且啟動。

  例:

  public void setUp() throws Exception {

  selenium = new DefaultSelenium("localhost",4444, "*iehta", "http://localhost:8080/");

  selenium.start();

  }

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